如何检测div元素中的溢出?

如何检测div元素中的溢出?,第1张

如何检测div元素中的溢出

您可以通过将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>

有关更多信息,请查看:http :
//help.dottoro.com/ljbixkkn.php



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5149287.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-18
下一篇 2022-11-18

发表评论

登录后才能评论

评论列表(0条)

保存