Jeo*_*ebs 7 javascript jquery javascript-events cordova
我只是想问一下是否有办法改变事件的门槛touchmove?在我的PhoneGap应用程序中,将出现一个图像.如果touchstart触发,则会出现另一个图像.如果touchend或被touchmove触发,所有图像必须消失.这是我的代码:
$('.greenApple').on('touchend', function (e){
$('body').find('.active').removeClass('active');
$('body').find('.greenApple').addClass('hidden');
flag = true;
return;
});
$('.greenApple').on('touchmove', function (e){
$('body').find('.active').removeClass('active');
$('body').find('.greenApple').addClass('hidden');
flag = true;
return;
Run Code Online (Sandbox Code Playgroud)
然而,被认为是a的像素数量的阈值touchmove太小.通常,只要我按下图像(不释放它,touchend没有被触发),图像就会因为touchmove事件被触发而消失.有没有办法改变被认为是移动的像素数touchmove?还是有其他解决方法?
谢谢.
不用找类,如果没有也不会做错什么
$('button').on('touchend', function (e){
/*no function whatsoever*/
console.log($("body").find('.active').first().html());
console.log($("body").find('.active').html());
/*only here*/
console.log($("body").html());
/*just do it this way*/
$('body').removeClass('active');
$('body').addClass('hidden');
flag = true;
return;
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2736 次 |
| 最近记录: |