2012-10-02 96 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。這沒有內置事件。

相關問題