[英]How to disable the scrollbars is width and height of body bigger than 1000px and 600px?
[英]jQuery's .height() function returns 0, when device width is less than 1000px
我有以下代码片段来查找div的高度。
当在设备中查看时,返回1400px,宽度超过1000px。 这是我想在所有视口中工作的东西,但是当在宽度小于1000px的设备中查看时,它返回0。
var $slideheight=parseInt($('.swiper-slide.swiper-slide-active').height());
div具有.swiper-slide.swiper-slide-active
类和display:block
样式属性,还包含HTML内容。
我无法弄清楚为什么我的代码在视口小于1000px宽度时返回0,而它适用于视口更多,超过1000px宽度。
尽量避免display:block
在绝对定位时display:block
,因为根据jQuery文档,强烈建议不要在<style>
或<script>
标记上调用这些方法。 除了不好的做法外,结果也可能证明是不可靠的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.