Created
April 20, 2012 19:43
-
-
Save latortuga/2431269 to your computer and use it in GitHub Desktop.
Attach a click handler to gallery images
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
| $(document).ready(function() { | |
| // page is ready, do things here | |
| }) | |
| $(document).on('click','#gallery img',function() { | |
| // click handler here | |
| }) |
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
| $('#gallery img').click(function() { | |
| var id = $(this).attr('data-id') | |
| window.href = "/products/" + id | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment