I would like to call functions when the browser window goes beyond a certain point
(e.g the user scrolled the window down beyond 200px from the top
Is there an e
if you dont want to use plugin you may try this
function isScrolledIntoView(elem)
{
//alert("method invoked");
var docViewTop = $(window).scrollTop();
var docViewBottom = docViewTop + $(window).height();
var elemTop = $(elem).offset().top;
var elemBottom = elemTop + $(elem).height();
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) && (elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
I had used this function to load images as lazy load. Called this function on scroll and then sent an ajax request based on the value of function returning value. this will send the ajax request when the user had scrolled to the bottom of the element (i.e used as the parameter in the method).
if(isScrolledIntoView($('.items:last'))){
//send the ajax request here
}
this is my first answer on this site. I hope you have will understand