天天看點

今天終于學會了下拉重新整理,上拉重新整理

<div id="megBox">

  <div id="refreshbar" style="height:0">下拉重新整理。。</div>

</div>

var touchPoint={

      Y:0,

      Loading:false

}

function InitTouch(){

  var box=document.getElementById("megBox");

  box.addEventListener("touchstart",function(target){

        touchPoint.Y=target.targetTouches[0].pageY;

  },false);

  box.addEventListener("touchmove",function(target){

        if(!touchPoint.Loading){

           var distance=target.targetTouched[0].pageY-touchPoint.Y;

           if(distance>100){

              touchPoint.Loading=true;

              $("#refreshbar").height(30);

              setTimeout(function(){

              //重新整理方法

               },2000);

           }

繼續閱讀