手机端课后练习上下滑动导致翻页问题 返回
-
手机端课后练习上下滑动时,如果不是直上直下,就会导致翻页
-
打开 app/exam/tpls/phone/lesson_ajaxquestion.tpl文件,找到下图位置
红圈中代码修改如下
var tapbox = $(".page-content").first();
var x,offx,y,offy;
tapbox.on("touchstart",function(event){
x = event.clientX || event.originalEvent.changedTouches[0].clientX;
y = event.clientY || event.originalEvent.changedTouches[0].clientY;
});
tapbox.on("touchend",function(event){
offx = event.originalEvent.changedTouches[0].clientX - x;
offy = event.originalEvent.changedTouches[0].clientY - y;
if(Math.abs(offx) > Math.abs(offy))
{
if(offx > 5)$('#questionpanel .jump.prev').trigger("click");
if(offx < -5)$('#questionpanel .jump.next').trigger("click");
}
offx = 0;
}); -