elize
elize

Reputation: 425

How do you detect top of an element is near of the bottom of browser with jQuery?

How do you detect top of an element is near of the bottom of browser with jQuery?

when I scroll down, if bottom of browser reach to top of an specal div,it alert me, and when I scroll up and bottom of browser reach to the top of that div,alert me again?

something like this website when scroll it down or up. (jquery effect)

Upvotes: 0

Views: 67

Answers (1)

Brave Soul
Brave Soul

Reputation: 3620

I think you looking for this. you can do this using below code.

var ScrollBottom = 100;

if ($(window).scrollTop() + $(window).height() > 
    $(document).height() - ScrollBottom) { 
    // your ajax call here
}

Upvotes: 1

Related Questions