[英]How to detect scroll event and direction in a not scrollable element using javascript?
[英]How can you detect if a scroll box (html element) is scrollable
奇怪的问题,但我想知道是否有一种可能的方法来检测具有多个属性的选择框是否可滚动(即列表中的足够元素需要滚动选择框)通过jQuery或javascript?
问候,
玛丽
您需要将元素的可见height()
与scrollHeight
,如下所示:
if ($('#foo').height() < $('#foo')[0].scrollHeight) {
alert('scrollable');
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.