//长按事件触发 $.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"); });