zippy1978 / jquery.scrollz

Modern scrolling for jQuery
GNU General Public License v2.0
81 stars 17 forks source link

Is it a easy way to make sure the pull header is closed when it is initialized? #10

Closed cardinal27513 closed 10 years ago

cardinal27513 commented 11 years ago

Looks like when it is initialized, the pull-down header is always open. What is the easy to to set it to be closed right after init?

Like I used $('#content').scrollz(/.../); to initialize Then right after than I called $('#content').scrollz('hidePullHeader'); The very 1st time, the header is not closed at all... But if I include some 100ms delay then it is closed.. It is a better way, like event/callback/deferredObj to use to do that or better yet, can we configured it to be closed after initialization is done by itself?

Also some time if even with this the header only close most half way.. But only have problem at the 1st hideheader call.. after that, it is smooth...

I just simplify the the mobile example have the code be below.. see the comment when $('#content').scrollz('hidePullHeader') is called..

            // Load more function        
            function loadMore() {
                var targetList = $('#tweets');
                targetList.empty();
                targetList.append ('<li>Tweet-1</li>');
                targetList.append ('<li>Tweet-2</li>');
                targetList.listview("refresh");
            }//loadMore

            loadMore();

            $('#content').scrollz('hidePullHeader'); //It does not take effect

            timer = setTimeout(function(){
                $('#content').scrollz('hidePullHeader'); //After 100ms, it works.
                timer = null;
            }, 100);
zippy1978 commented 11 years ago

Hi,

You can actually use the code I posted here : https://github.com/zippy1978/jquery.scrollz/issues/2.

I hope it will help you !

cardinal27513 commented 11 years ago

Just tried and it works.

cardinal27513 commented 11 years ago

Any reason why you wont include that as part of code base & provide an option to set that if want to go a bit fancy?

    $(document).on("pageshow", ":jqmData(role='page')", function() {

      // Force resize
      $(window).resize();
      $(":jqmData(scrollz='pull')").scrollz('hidePullHeader', false);     
    });
zippy1978 commented 11 years ago

I don't remember actually... I will do it