我已经实现了触发器,它像我的鼠标事件一样唤起了同样的功能:
onclick - > touchstart {做某事}
mousemover - > touchmove {做某事}
mouseup - > touchend {做某事}
所有作品都会触发,但不会触发。
document.body.addEventListener('touchstart', start);
function start(e){ do something ; touchDefaults(e); }
document.body.addEventListener('touchmove', move );
function move(e){ do something ; touchDefaults(e); }
document.body.addEventListener('touchend', end );
function end(e){ do something ; touchDefaults(e); }
document.body.addEventListener('touchcancel', cancel );
function cancel(e){ touchDefaults(e); }
document.body.addEventListener('touchleave', leave );
function leave(e){ touchDefaults(e); }