zippy1978/jquery.scrollz

How to disable automatic pull after document is finish loading

Opened this issue · 1 comments

In mobile.html, I noticed the pull is launched automatically after the document has finished loading. I would love to know how to disable that on the document load and only keep it on user pull event. Thanks

Hi,
The best is to disable content loading initially.

If you look at the code of the mobile.html example:

  1. Comment the initial data loading and hide the pull header:

        // Load initial items
        //loadMore();
        setTimeout(function() {
            $('#content').scrollz('hidePullHeader', false);
        }, 20);
    
  2. Modify the bottomreached event handling to prevent loading more items if the current list is still empty:

        // Bind events
        $(document).on('bottomreached', '#content', function() {
            // Load more
          if ($('#items li').length > 0) {
            loadMore();
          }
    
        });
    

I hope it will help you.

Regards,
Gilles