Ram*_*Ram 6 javascript css jquery twitter-bootstrap
jquery的height属性总是返回0.我和Bootstrap一起使用它.不确定是否会发生冲突.我经历了几个在线推荐的解决方案,但没有解决它.以下是代码段
/*html */
<div class="hidden-sm hidden-md hidden-lg" class="mobNewsEvents">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<h3 style="text-align: center;">Events</h3>
<div class="mobEvents"> //need to get the height of this div element
<ul>
<li>...</li>
</ul>
</div>
</div>
</div>
</div>
/*script*/
(function($){
$(window).load(function(){
var temp = $('.mobEvents').height();
alert(temp);
});
})(jQuery);
Run Code Online (Sandbox Code Playgroud)
Ama*_*dan 10
class="hidden-sm hidden-md hidden-lg"暗示这可能是display: none.在这种情况下,height不可用.显示它,测量它,然后隐藏它.
| 归档时间: |
|
| 查看次数: |
14533 次 |
| 最近记录: |