机型:红米、华为等。
document.querySelector('.container').addEventListener('touchstart', function(){
console.log('touchstart: is_touch true');
is_touch = true;
}, false);
document.querySelector('.container').addEventListener('touchend', function(){
console.log('touchend: is_touch false');
is_touch = false;
}, false);
document.querySelector('.container').addEventListener('touchcancel', function(){
console.log('touchcancel: is_touch false');
is_touch = false;
}, false);
滑动过程,控制台输出:
touchstart: is_touch true at js/common.js:400
touchcancel: is_touch false at js/common.js:408
蔡繁荣 (作者)
如果是底层的问题,那要怎么办呢?
2015-07-28 21:57
蔡繁荣 (作者)
网上有看到很多遇到这个问题的,有些Android没有触发touchend 事件
2015-07-29 00:47
DCloud_UNI_FXY
回复 蔡繁荣:把touchcancel当成touchend来使用。也就是说,如果你直接用底层事件,可以把你touchend要处理的逻辑,同时放在touchend和touchcancel里边。
2015-07-29 01:45