Margaret
Margaret

Reputation: 13

How do I check whether the scrollbar is at the beginning or end?

how do I check whether the scrollbar is at the beginning or end with jquery? For the beginning part i would check if $(window).scrollTop <= 0, but what should i use for the end?

Thank you

Upvotes: 1

Views: 155

Answers (1)

Matt Ball
Matt Ball

Reputation: 359816

Use this:

($(window).scrollTop() + $(window).height() >= $(document).height())

Upvotes: 2

Related Questions