Created
December 16, 2015 16:54
-
-
Save MatthieuScarset/831d77bedc6338e66d00 to your computer and use it in GitHub Desktop.
make an element clickable
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
// How to use? | |
makeClick($('.clickable')); //Make things clickable | |
/* | |
* Make an HTML element clickable | |
* Usefull for a fully clickable div without to wrap it in a <a> | |
* @param $el jQuery DOM object(s) | |
* return void | |
*/ | |
function makeClick($el) { | |
$el.on("click", function () { | |
$(this).style.cursor = "pointer"; | |
window.location = $(this).find("a").attr("href"); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment