fapiao.html 1.44 KB
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	    <title></title>
	    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
	    <meta name="format-detection" content="telephone=no" />
	    <meta name="format-detection" content="email=no" />
	    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
	    <meta name="apple-mobile-web-app-capable" content="yes" />
	    <meta name="apple-mobile-web-app-title" content="">
	    <meta name="google" value="notranslate"><!-- 禁止Chrome 浏览器中自动提示翻译 -->
	</head>
	<style>
		.touch_action{  
			-webkit-touch-callout:none;  
			-webkit-user-select:none;  
			-khtml-user-select:none;  
			-moz-user-select:none;  
			-ms-user-select:none;  
			user-select:none;  
		}  
	</style>
	<body>
		<div id="mydiv">sdfjkdksae</div>
	</body>
</html>
<script src="../../../js/jquery-3.2.1.min.js"></script>
<script>
	window.ontouchstart = function(e) { 
		e.preventDefault();
	};
	$.fn.longPress = function(fn) {
	    var timeout = undefined;
	    var $this = this;
	    for(var i = 0;i<$this.length;i++){
	        $this[i].addEventListener('touchstart', function(event) {
	            timeout = setTimeout(fn, 800);
	            }, false);
	        $this[i].addEventListener('touchend', function(event) {
	            clearTimeout(timeout);
	            }, false);
	    }
	}
	$('#mydiv').longPress(function(){
	    alert(1);
	});
</script>