Html5 手机网页中,长按会触发系统事件,请问怎么取消这些事件

html-css08

Html5 手机网页中,长按会触发系统事件,请问怎么取消这些事件,第1张

在页面中样式中加上下面的css代码

*{

-webkit-overflow-scrolling: touch

-webkit-touch-callout:none

-webkit-user-select:none

-khtml-user-select:none

-moz-user-select:none

-ms-user-select:none

user-select:none

}

你指的是禁用默认事件看

<a href="baidu.com">百度</a>

1.jQuery 阻止默认事件

$("a").click(function( event ) {

    event.preventDefault() // 阻止默认事件

    event.stopPropagation() // 阻止冒泡

})

2.javascript 

var elem = document.getElementByTagName("a")

elem.addEventListener("click",function(event){

    event.preventDefault() // 阻止默认事件

    event.stopPropagation() // 阻止冒泡

 },false)

说明:

preventDefault()   // 阻止默认事件

stopPropagation()  // 阻止冒泡

return false   // 既阻止默认事件 也阻止冒泡