I want to check if a horizontal scrollbar is applied to a div like this:
if (box.width() < box.get(0).scrollWidth)
This is always true, even when there isn’t any scrollbar, because box.get(0).scrollWidth returns 203px, while .width() returns 200.
Here I have an example, please look at the first box. $('.box0')
I just this to determine if a div is overflowing – ie scrollable :
usage :
$('#<id>').hasScrollBar();returns true / false*from SO originally I think