[英]HTML Element: get notified when the scrollbar appears
I have a div like this: 我有这样的股利:
<div id='test' style='overflow:auto'>
...
</div>
In javascript (no jquery) How do I know when - as a consequence of the user resizing the browser - the div is showing a horizontal bar or not ? 在javascript中(不使用jquery)如何得知(由于用户调整浏览器大小而导致)div是否显示水平条?
Note: I don't want only to figure if it is showing horizontal bar or not, I want to be notified when that happens. 注意:我不想只想知道它是否显示水平条,我想在发生这种情况时得到通知。
If you want to hook the resize of window 如果要挂钩窗口的调整大小
window.onresize = function(){
var test = document.getElementById("test");
if(test.offsetHeight != test.scrollHeight)
// raise event or call ur method
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.