'How to know the height of the div when its overflow is hidden
I have a div, which have overflow hidden. Now want to display a arrow , up and down , up when we have overflow up and down arrow when we have overflow down.
And no arrows if there is no overflow in the div.
Solution 1:[1]
You can check if the scrollHeight
property is greater than the element's clientHeight
.
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight
if (el.scrollHeight > el.clientHeight) {
// do something
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | chris coerdes |