Skip to content

Instantly share code, notes, and snippets.

@latortuga
Created April 20, 2012 19:43
Show Gist options
  • Select an option

  • Save latortuga/2431269 to your computer and use it in GitHub Desktop.

Select an option

Save latortuga/2431269 to your computer and use it in GitHub Desktop.
Attach a click handler to gallery images
$(document).ready(function() {
// page is ready, do things here
})
$(document).on('click','#gallery img',function() {
// click handler here
})
$('#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