//滑动动作
// $('body').on('touchstart',touchStart);
// $('body').on('touchmove',touchMove);
// $('body').on('touchend',touchEnd);
document.body.addEventListener("touchstart", touchStart, false);
document.body.addEventListener("touchmove", touchMove, false);
document.body.addEventListener("touchend", touchEnd, false);
var canefresh = false;
function touchStart(e){
if($(window).scrollTop() <= 0){
canefresh = true;
}
// var touch = e.originalEvent.targetTouches[0];
var touch = e.touches[0];
startY = touch.pageY;
}
function touchMove(e){
// e.preventDefault();
if(!canefresh){
return;
}
// var touch = e.originalEvent.targetTouches[0];
var touch = e.touches[0];
endY = touch.pageY;
$('body').css('padding-top',endY - startY);
}
function touchEnd(e){
if(!canefresh){
return;
}
console.log(endY - startY);
if((endY - startY) > 50){
location.reload();
}
$('body').css('padding-top','');
canefresh = false;
}