Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable automatic pull after document is finish loading #22

Open
mal3k opened this issue Jul 21, 2014 · 1 comment
Open

How to disable automatic pull after document is finish loading #22

mal3k opened this issue Jul 21, 2014 · 1 comment
Labels

Comments

@mal3k
Copy link

mal3k commented Jul 21, 2014

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

@zippy1978
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants