Created
November 14, 2012 20:39
-
-
Save truncs/4074634 to your computer and use it in GitHub Desktop.
Single and Double click together
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
var clicks = 0; | |
$('li').live({ | |
click: function() { | |
node = $(this); | |
clicks++; | |
if (clicks == 1) { | |
setTimeout(function() { | |
if(clicks == 1) { | |
console.log('single click!'); | |
} else { | |
console.log('double click!'); | |
} | |
clicks = 0; | |
}, 300); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment