标签:class tran highlight pagex 事件 tde blog end else
var startPosition,endPosition,deltaX,deltaY,moveLength,;
$(".cover").on(‘touchstart‘, function(e){
e.preventDefault();
var touch = e.touches[0];
startPosition = {
x: touch.pageX,
y: touch.pageY
}
}).on(‘touchmove‘, function(e){
e.preventDefault();
var touch = e.touches[0];
endPosition = {
x: touch.pageX,
y: touch.pageY
};
deltaX = endPosition.x - startPosition.x;
deltaY = endPosition.y - startPosition.y;
//moveLength = Math.sqrt(Math.pow(Math.abs(deltaX), 2) + Math.pow(Math.abs(deltaY), 2));
}).on(‘touchend‘, function(e){
e.preventDefault();
if(deltaY < -50) { // 向上划动
$(‘.wrap‘).css({
"-webkit-transform": "translate3d(0, -100%, 0)"
});
startPosition=null;
endPosition=null;
deltaX=0;
deltaY=0;
} else if (deltaY > 0) { // 向下划动
}
});
标签:class tran highlight pagex 事件 tde blog end else
原文地址:http://www.cnblogs.com/mbyund/p/6946663.html