Auto load content on scroll down

前端 未结 3 877
北恋
北恋 2021-02-09 14:49

I am creating a blog on django/webfaction. My hompage currently displays 4 posts by default (posts are limited to 4 on queryset in urls.py). Now I woul

3条回答
  •  Happy的楠姐
    2021-02-09 15:35

    You can try something like this..

    var processScroll = true;
    $(window).scroll(function() {
        if (processScroll  && $(window).scrollTop() > $(document).height() - $(window).height() - 100) {
            processScroll = false;
            // your functionality here
            processScroll = true;
        }
    });
    

提交回复
热议问题