$.fn.longPress = function (fn,trsTime) { //长按监听 var $this = this; for (var i = 0; i < $this.length; i++) { (function (target) { var timeout; target.addEventListener('touchstart', function (event) { quxiaoanniu(); //关闭删除按钮(取消按钮) var index = $("body").index(this); //这里获取当前选中是第几个div timeout = setTimeout(function () { fn(event); //$("body .demo").eq(index)… 这样就能获取到当前这个div上要获取的内容了 }, trsTime ? trsTime : 200); }, false); target.addEventListener('touchend', function (event) { clearTimeout(timeout); }, false); })($this[i]); } } $(".xuanzetupian").longPress(function (e) {//长按执行 },1500)