//长按事件触发 $.fn.longPress = function(fn) { var timeout = undefined; var $this = this; for(var i = 0; i < $this.length; i++) { (function(target) { var timeout; target.addEventListener('touchstart', function(event) { timeout = setTimeout(function() { //fn.apply(target); fn(event); }, 500); }, false); target.addEventListener('touchend', function(event) { clearTimeout(timeout); }, false); })($this[i]); } }
//调用事件 $("#id").longPress(function(e){ alert("adfs"); });
jq 触摸长按触发事件
猜你喜欢
转载自www.cnblogs.com/TuWenHao/p/9159523.html
今日推荐
周排行