0

Is there an option how to remove or disable scroll listener after reaching certain point on page? I'm not interested in load browser by listener when I don't need it anymore.

In my case a want to someway stop this whole particular function below after calls loadMore(load_btn);

The function:

$(window).scroll(function(){
    var load_btn = $('.js-load-more.auto-load:not(.loading)');
    var scroll = $(window).scrollTop();
    var height = $(window).height();
    var btn_top = $(load_btn).offset().top;
    var launch_pos = btn_top - (height - (height*0.1));

    if (scroll > launch_pos) {
        $(load_btn).removeClass('auto-load');
        loadMore(load_btn);
    }
});

0 Answers0