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
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!