Ok guys. I have a link with class name "more_updates". I want the load more link to be triggered automatically everytime the user reach 80% of the page.
I'm listing 50 products. Each row contains 5 products with images. At the bottom i have load more link. If the user reach 7th or 8th row then the load more link should be triggered automatically. This is the code i'm using. But it loading more products. Please tell me whats wrong in this code. Thanks
<!-- language: lang-js -->
$(window).scroll(function(){
if ($(window).scrollTop() >= ($(document).height() / 2) - $(window).height()){
if (!flag) {
// if is not loading data, start the call
$('.more_updates').click(); // to invoke the click event of loading updates
}
}
});