Skip to content

Instantly share code, notes, and snippets.

@MicFin
Last active August 29, 2015 14:04
Show Gist options
  • Save MicFin/7fa8608d343623d76142 to your computer and use it in GitHub Desktop.
Save MicFin/7fa8608d343623d76142 to your computer and use it in GitHub Desktop.
$(function() {
$('#thumbs a').on('click', function(e) {
e.preventDefault();
$('#thumbs img').css('border', 'none');
$(this).find('img').css('border', 'solid 2px black');
var newSrc = $(this).find('img').attr('src');
$('#fullsize img').attr('src', newSrc);
var newCaption = $(this).find('img').data('caption');
$('#fullsize p').text(newCaption);
$('#modal, #modalBg').fadeIn();
});
$('#modalBg').on('click', function(){
$('#modal, #modalBg').fadeOut();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment