【发布时间】:2018-08-05 04:43:29
【问题描述】:
我使用stackoverflow的link在我的项目中向左/向右滑动写入,但现在我希望在每次滑动1秒后和触摸启动激活1秒后触摸启动不活动。在下面我想到的唯一算法中,但效果不好。
var drag = true;
function touchStart(event, passedName){
if(!drag){
// document.removeEventListener('touchstart', touchStart, false);
return;
}
else{
drag = false
}
// do for touchstart
setTimeout(function(){
drag = true;
}, 1000);
}
我在 touchMove 中添加了这段代码:
function touchMove(event){
ul.style.left = event.touches[0].pageX - x + 'px';// touchstart inactive but element still moving
}
【问题讨论】:
-
“效果不好”?
标签: javascript