April 9, 2012
Detect when Browser Scrolls Below a Certain Point
Question by user1277170
I have a webpage filled with divs, and when the page reaches 300px from the bottom, it loads more divs.
I’m having trouble finding a detection that works everywhere.
I need some JavaScript (i.e. not JQuery) if statement to put into the body’s onscroll function that will detect the browser scrolling below 300px from the bottom, which works with IE, FF, Chrome, Opera, Safari, Android browsers, iBrowsers, etc.
Answer by Starx
You have to know the position of the point, then checks the window scrollTop
if ($(window).scrollTop() > point) {
//Carry On
}