how to detect if the end of horizontal scrollbar is reached?

Viewed 2681

I have a div wich is scrollable horizontally. I want to know when I reach the end of it.

Is there is simple way to detect if the horizontal scrollbar is scrollable to one direction or the other?

1 Answers

To check the horizontal scrollbar you need to use

var scrollLeft = $('#div_id').scrollLeft();

You can then check if it's equal to the $('#div_id').width() and there's the end.

Related