jquery mobileはhtml 5ドロップダウンリフレッシュを実現し、pcとphoneの互換性を実現する

4653 ワード




    
    
    
    
    
    
    

    

    

    

    

    
        $(function() {
            getdata();

        });
        function getdata() {
            var json = [{ name: "     1", age: 20 }];
            var html = "";
            if (json != "") {
                for (var i = 0; i < json.length; i++) {
                    html += "<li><a href=''>";
                    html += "<h3>" + json[i].name + "</h3>";
                    html += "<p>" + json[i].age + "</p>";
                    html += "</a></li>";


                }
            }
            $("#list").append(html);
            $('#list').listview('refresh');
        }      
    

    

        (function pullPagePullImplementation($) {
            "use strict";
            var listSelector = "div.pull-demo-page div.mycolset",
      lastItemSelector = listSelector;



            function gotPullDownData(event, data) {
                var iscrollview = data.iscrollview;
                //      
                getdata();
                iscrollview.refresh(null, null,
                  $.proxy(function afterRefreshCallback(iscrollview) {
                      this.scrollToElement(lastItemSelector, 400);
                  }, iscrollview));

            }

            function gotPullUpData(event, data) {
                var iscrollview = data.iscrollview;
                //      
                getdata();
                iscrollview.refresh(null, null,
      $.proxy(function afterRefreshCallback(iscrollview) {
          this.scrollToElement(lastItemSelector, 400);
      }, iscrollview));
            }

            function onPullDown(event, data) {
                setTimeout(function fakeRetrieveDataTimeout() {
                    gotPullDownData(event, data);
                },
      1500);
            }

            // Called when the user completes the pull-up gesture.
            function onPullUp(event, data) {
                setTimeout(function fakeRetrieveDataTimeout() {
                    gotPullUpData(event, data);
                },
      1500);
            }

            // Set-up jQuery event callbacks  
            $(document).delegate("div.pull-demo-page", "pageinit",

    function bindPullPagePullCallbacks(event) {
        $(".iscroll-wrapper", this).bind({
            iscroll_onpulldown: onPullDown,
            iscroll_onpullup: onPullUp
        });
    });


        } (jQuery));



    



    
       
 
  
       
 
  
       
http://download.csdn.net/detail/wf001015/9824775