Created
June 18, 2016 11:50
-
-
Save bantya/b73316c3e44f0540c9661f74f43b86b1 to your computer and use it in GitHub Desktop.
JavaScript: Check if ghost click
This file contains hidden or 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
//check if click event firing twice on same position. | |
var last_click_time = new Date().getTime(); | |
function gc(e){ | |
var click_time = e['timeStamp']; | |
if (click_time && (click_time - last_click_time) < 1000) { | |
e.stopImmediatePropagation(); | |
return false; | |
} | |
last_click_time = click_time; | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment