我正在尝试提供一种更好的移动方式来在jQuery中dblclick,但是我一直在遇到错误,this.each is not a function
一直存在。另外,这是全局窗口对象,而不是
`jQuery.fn.dblclick =(回调)=> { var touchtime; console.log({this:this});
return this.each(()=>{
$(this).on("click", function (e) {
if (touchtime == 0) {
touchtime = new Date().getTime();
} else {
if (((new Date().getTime()) - touchtime) < 800) {
callback(e);
touchtime = 0;
} else {
touchtime = new Date().getTime();
}
}
});
});
};
// a few lines later...
$('button').dblclick((e)=>{...})`
这是一个jsfiddle:click here