滑动切换图片

一、

onmousedown()->ontouchstart()
onmousemove()->ontouchmove()
onmouseup()->ontouchend()
 
click事件在移动端有300毫秒延迟
二、判断速度
Date.now();//html5记录当前时间
三、速度减慢发生跳跃
在超过图片部分时加
if(bBtn){
    bBtn = false;
    downX = touchs.pageX;          
}
三、防止滑动时误点击链接
<a data-href="www.baidu.com" ontouchmove="this.flag=1" ontouchend="this.flag||window.open(this.dataset.href),this.flag=0"></a>
四、移动端少用transition,可以用tween
五、去电点击a链接的黑影
-webkit-tap-highlight-color:rgba(255,0,0,0)
六、移动端移动考虑效率,用translateX/Y/Z代替position:absolute;left
原文地址:https://www.cnblogs.com/shytong/p/4960400.html