문제

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?

도움이 되었습니까?

해결책

I assume you're referring to the overflow css property of DOM nodes. In that case you could compare the scrollWidth as opposed to the clientWidth.

Understanding offsetWidth, clientWidth, scrollWidth and -Height, respectively

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top