jquery.scrollz icon indicating copy to clipboard operation
jquery.scrollz copied to clipboard

How to disable automatic pull after document is finish loading

Open mal3k opened this issue 11 years ago • 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

mal3k avatar Jul 21 '14 04:07 mal3k

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

zippy1978 avatar Aug 10 '14 19:08 zippy1978