更改分区高度jQuery



我正在尝试从更改div的样式

<div id="map" style="height:25%;"></div>

<div id="map" style="height:0%;"></div>

点击

jQuery

$('hideMap').css({"height":"0%"});

  • <li><a name="hideMap" class="btn red"><i class="material-icons" style="color:white;">notifications_active</i></a></li></li>
    

    如果您能提供帮助,请提前感谢:)

  • $('hideMap').css({"height":"0%"});

    你想改变地图div的高度吗?然后你可以在下面写代码

    $('#map').css({"height":"0%"});

    下面是工作小提琴

    https://jsfiddle.net/7cfcfrnr/

    尝试:

    $('#map').css("height","0");
    

    您的div id是map,需要在jquery选择器中使用#作为id,使用.作为类名。

    $('hideMap').css({"height":"0%"});更改为$('#map').css({"height":"0%"});

    Javascript:

    document.getElementById('map').style.height = '50%';
    

    Jquery:

    $("#map").height("50%");
    

    最新更新