some content Say that the container div is resized, on re...">

Is there a way to program if the <div> overflows

<div id="container">
  some content
</div>

      

Say that the container div is resized, on resizing, how do I know if it is already overflowing (inner content width <container width or inner content height <container height)?

+2


source to share


1 answer


As far as I know, the only way is to compare

clientHeight < scrollHeight

for vertical scrollbar



and

clientWidth < scrollWidth

for a horizontal scroll bar.

+3


source







All Articles