您的位置:首页 > Web前端 > HTML5

H5长按事件

2016-04-01 10:22 387 查看
let timeOutEvent = 0
$(function () {
$('#debug').on({
touchstart: function (e) {
setTimeout(function () {
longPress()
}, 10000)
e.preventDefault()
},
touchmove: function () {
clearTimeout(timeOutEvent)
timeOutEvent = 0
},
touchend: function () {
clearTimeout(timeOutEvent)
return false
}
})
})

/* eslint-disable no-unused-vars */
function longPress () {
timeOutEvent = 0
router.go('about')
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: