Created
May 21, 2012 23:17
-
-
Save ericmann/2765331 to your computer and use it in GitHub Desktop.
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
Set up images like this: | |
<div id="raffle"> | |
<img src="..." data-link="http://link.url" /> | |
<img src="..." data-link="http://link.url" /> | |
</div> | |
Then set up a JS event listener: | |
jQuery('#raffle').on('click', 'img', function(e) { | |
var href = $(this).data('link'); | |
window.location = href; | |
}); | |
This lets you bind an event listener to the entire slide show and simulate link clicks ... | |
without actually using `<a>` tags. | |
More on event delegation here: http://jumping-duck.com/tutorial/javascript-event-listeners/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment