//页面滑动时禁止触发touchend事件 function stopTouchendPropagationAfterScroll() { var locked = false; window.addEventListener('touchmove', function() { locked || (locked = true, window.addEventListener('touchend', stopTouchendPropagation, true)); }, true); function stopTouchendPropagation(ev) { ev.stopPropagation(); window.removeEventListener('touchend', stopTouchendPropagation, true); locked = false; } }
直接调用 stopTouchendPropagationAfterScroll();