码迷,mamicode.com
首页 > 其他好文 > 详细

今天终于学会了下拉刷新,上拉刷新

时间:2016-05-18 22:11:37      阅读:317      评论:0      收藏:0      [点我收藏+]

标签:下拉刷新   上拉加载   

<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);

           }

        }

  },false);

}

今天终于学会了下拉刷新,上拉刷新

标签:下拉刷新   上拉加载   

原文地址:http://cuijinfeng.blog.51cto.com/5555200/1774816

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!