用于"doubletap"的"touchstart"事件可防止向上或向下滑动时滚动



我添加了一个"触摸启动";事件到";tbody";所以当我双击一行时,函数就会出现。这非常有效,但可以防止在移动设备中向上或向下滚动(所以如果我的表有足够的行,你会被卡住(

//DoubleClick not working on doubleTap, so...
$("tbody").on("touchstart", tapHandler);
var tapedTwice = false;
function tapHandler(e) {

if(!tapedTwice) {
tapedTwice = true;
setTimeout( function() { tapedTwice = false; }, 300 ); //doubletap speed
return false;
}
e.preventDefault();//Prevents zoom, but without it, scroll still not working
lightboxPrint(e);  //Fx for this event
}

已经尝试删除所有CSS和Bootstrap。唯一会出现问题的函数是这个。如果这可以修复,我可以为"添加一个新事件吗;向上滑动";或";向下滑动";滚动?

我用特里的话回答,只是为了结束这个问题。他应该得到充分的赞扬而不是以"开头;tapedWice=false";,我刚从";tapedWice=true";并相应地改变功能。

$("tbody").on("touchstart", tapHandler);
var tapedTwice = true;
function tapHandler(e) {

if(tapedTwice) {
tapedTwice = false;
setTimeout( function() { tapedTwice = true; }, 300 );
return true;
}
e.preventDefault();//Para evitar el zoom
lightboxPrint(e);  
};

最新更新