更多腾讯海量技术文章,请关注云加社区:https://cloud.tencent.com/developer
作者:feix760
怎么复现这个问题
1、首先随意的滑两次,每次滑长一些,不用滑重(碎屏就不好了~~)
2、再点击一次,之后立刻停住~
Oh, no 你肯定在我说停住之后再点了一下,你觉得你并没有点到~
反复试几次仔细发现,原来是要点两次!
为什么会这样
zepto 发出you tap me的嚎叫可以用下面代码归纳
Android 4.4 touch事件
长距离的滑动: touchstart - > touchmove(仅一次) -> touchcancel
短距离: touchstart - > touchmove(一次) -> touchend
事情发展到了这里,去下载最新的zepto发现也只在touchend里做了这件重要的事情
deltaX = deltaY = 0;
哎~
https://cloud.tencent.com/developer/article/1004711
Android 4.4 长距离的滑动touchmove只发生一次是不是让充满爱的FE瞬间变得忧伤了~
哈~,其实只需touchmove时e.preventDefault()
touchstart - > touchmove(仅一次) -> touchcancel
就能变成
touchstart - > touchmove(多次) -> touchend
(也不再是touchcancel了)
领取专属 10元无门槛券
私享最新 技术干货