手机端禁止手指滑动屏幕触发点击事件

function stopTouchendPropagationAfterScroll(){
	var locked = false;
			
	window.addEventListener('touchmove', function(ev){
		locked || (locked = true, window.addEventListener('touchend', stopTouchendPropagation, true));
	}, true);
			    
	function stopTouchendPropagation(ev){
		ev.stopPropagation();
		window.removeEventListener('touchend', stopTouchendPropagation, true);
		locked = false;
	}
}

 

你可能感兴趣的:(JavaScript)