admin管理员组文章数量:1321608
My site has numerous horizontal lists of words. If the row has too many words to display in one row, it needs to display an "expand" button. Right now I determine if the row is full by adding up the estimated widths of the letters, but I am wondering if there is a simpler way to do this. Is there any way using javascript or any library (especially YUI or jQuery) to determine if an element has overflow?
My site has numerous horizontal lists of words. If the row has too many words to display in one row, it needs to display an "expand" button. Right now I determine if the row is full by adding up the estimated widths of the letters, but I am wondering if there is a simpler way to do this. Is there any way using javascript or any library (especially YUI or jQuery) to determine if an element has overflow?
Share Improve this question asked Apr 1, 2014 at 3:07 michaelAdammichaelAdam 1,1371 gold badge14 silver badges31 bronze badges 1- Possible duplicate of stackoverflow./questions/7668636/… – Patrick Allen Commented Apr 1, 2014 at 3:14
1 Answer
Reset to default 7I assume you're referring to the overflow css property of DOM nodes. In that case you could pare the scrollWidth as opposed to the clientWidth.
Understanding offsetWidth, clientWidth, scrollWidth and -Height, respectively
本文标签: javascriptIs there anyway to check if an element has overflowedStack Overflow
版权声明:本文标题:javascript - Is there anyway to check if an element has overflowed? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742105375a2420992.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论