Created
March 16, 2015 09:16
-
-
Save dbushell/fec0ba804e4f06c46d4d to your computer and use it in GitHub Desktop.
Fake links in jQuery, useful for making whole elements clickable while the actual <a> is smaller inside.
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
$(document).on('click', '[data-href]', function(e) | |
{ | |
var t = e.target; | |
if (t && t.nodeType === 1 && t.nodeName.toLowerCase() === 'a') { | |
return; | |
} | |
window.location.href = $(e.currentTarget).data('href'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment