2

Possible Duplicate:
How can I check if a scrollbar is visible?

I have a div with overflow : auto so i don't know when it scrolls. But it does depending upon the layout. Now i need to know when it is scrolling so that i can apply some business logic in it. How to capture this event?

Community
  • 1
  • 1
coderslay
  • 13,230
  • 29
  • 72
  • 118

1 Answers1

1

You can check this way. You need to attach a handler when the content changes. And check if the content width, height and scrollWidth, scrollHeight are equal.

You can do with jQuery, this way:

if ($("div").scrollHeight == $("div").height)
   // Has Scrollbars
Praveen Kumar Purushothaman
  • 160,666
  • 24
  • 190
  • 242