2012-10-02 1328 views

回答

2

你可以做到这一点的scrollHeight属性与clientHeight比较。

<script type="text/javascript"> 
function GetContainerSize() 
{ 
    var container = document.getElementById ("tempDiv"); 
    var message = "The width of the contents with padding: " + container.scrollWidth + "px.\n"; 
    message += "The height of the contents with padding: " + container.scrollHeight + "px.\n"; 

    alert (message); 
} 
</script> 

欲了解更多信息:How to detect overflow in div element?

0

你可以设置的时间间隔,并检查元素的scrollHeight > offsetHeight。这没有内置事件。

相关问题