There are a ton of questions about figuring out whether or not an element is overflowed:
But I need a little more specificity.
I have an element that's being overflowed horizontally, meaning the user can scroll either to right or to the left.
I would like a way of figuring out if the element has been overflowed to either direction. In other words, if the element is pushed all the way to the left, then this function would return true for overflowRight and false for overflowLeft.
This is what I'm using now:
function isOverflowed(element){
return element.scrollWidth > element.clientWidth;
}
It returns a bool indicating whether there is any overflow at all, but doesn't offer a configuration for direction.
How can I figure out whether or not my element is overflowing left or right?
Thanks!