Created
November 28, 2017 12:37
-
-
Save pavlakis/9fe987d8b20b0df3e196b3c3c790d024 to your computer and use it in GitHub Desktop.
Handling double-click on single click events
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
function bindMessageButton() { | |
"use strict"; | |
var $msgButton = $('a.msg'); | |
$msgButton.attr('href', '#'); | |
$msgButton.on('click', function (e) { | |
e.preventDefault(); | |
$msgButton.unbind(); | |
$msgButton.removeAttr('href'); // fix for double click jump | |
// ... do stuff ... | |
bindMessageButton(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternatively, always have
href
removed from the anchor tag and use a CSS class to change the cursor to a pointer.