Skip to content

Instantly share code, notes, and snippets.

@titopandub
Created June 21, 2014 07:23
Show Gist options
  • Select an option

  • Save titopandub/56a029cb422c8165a4c6 to your computer and use it in GitHub Desktop.

Select an option

Save titopandub/56a029cb422c8165a4c6 to your computer and use it in GitHub Desktop.
Make any element can be click to go to another page using jQuery and data attribute (using data-link in this case)
$(".slideshow img").each(function () {
if ('' !== $(this).data('link')) {
$(this).click(function (e) {
window.location.href = $(this).data('link');
});
$(this).css('cursor', 'pointer');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment