Created
August 31, 2015 05:21
-
-
Save abrjagad/25900261b284f3ce7dac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.event.special.abetap = { | |
delegateType: "tap", | |
bindType: "tap", | |
handle: function (event) { | |
var handleObj = event.handleObj; | |
var targetData = jQuery.data(event.target); | |
var ret = null; | |
event.preventDefault(); | |
if (!targetData.counter && !targetData.timer) { | |
//debugger; | |
targetData.counter = Date.now(); | |
targetData.timer = setTimeout(function () { | |
clearTimeout(targetData.timer); | |
delete targetData.counter; | |
}, 500); | |
console.log(targetData); | |
} else { | |
if (Date.now() - targetData.counter < 500) { | |
event.type = handleObj.origType; | |
ret = handleObj.handler.apply(this, arguments); | |
event.type = handleObj.type; | |
return ret; | |
} | |
clearTimeout(targetData.timer); | |
delete targetData.counter; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment