Skip to content

Instantly share code, notes, and snippets.

@glebcha
Created November 27, 2013 04:22
Show Gist options
  • Save glebcha/7670625 to your computer and use it in GitHub Desktop.
Save glebcha/7670625 to your computer and use it in GitHub Desktop.
Simple full-size preview popup.
var thumbModal = function (thumbs, fullImgContainer) {
for (var i = 0; i < thumbs.length; i++) {
var thumb = thumbs[i];
var show = function (event) {
event.preventDefault();
var imgBlock = this.querySelector(fullImgContainer);
if (imgBlock.style.display != 'block') {
$(fullImgContainer).hide();
$(imgBlock).fadeIn(500);
} else {
$(imgBlock).fadeOut(500);
}
};
$(thumb).bind('click', show);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment