标签:
var nStartX,nEndX,nDetalX;
function touchToNextPage(){
document.addEventListener(‘touchstart‘, function (e) {
//获得手指开始碰触屏幕时的x坐标
nStartX = e.touches[0].pageX;
},false);
document.addEventListener(‘touchmove‘, function (e) {
//获得手指滑动过程中的x坐标
nEndX =Number(e.touches[0].pageX);
if(nStartX - nEndX > 10){
//翻页
window.location.href ="article-1-2.html";
}else if(nStartX - nEndX< -10){
//返回上一页
history.go(-1);
}
},false);
}
touchToNextPage();
标签:
原文地址:http://blog.csdn.net/u011011025/article/details/46459171