长按press事件会致使浏览器弹出菜单:css
方法一:html
苹果禁止:jquery
-webkit-touch-callout: none;
安卓的不行。禁止弹出只能用js来控制:web
$('a').ontouchstart = function(e) { e.preventDefault(); };
方法二:浏览器
将<a>标签换成其余的标签,如<button>,<div>,<p>。而后绑定touchstart,click事件js跳转。
spa
<div class="jump">连接</div> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script> $('.jump').on('touchstart', function () { location.href = ""; }) </script>
若是想要禁止文本被选中,能够加上csscode
.jump { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }