A simple image gallery
Click a thumbnail to change the big picture, with a small fade.
jQuery · A simple image galleryIntermediate
$('.thumbs').on('click', 'a', function (e) {
e.preventDefault();
const $link = $(this);
const src = $link.attr('href');
$('#big').stop(true).fadeTo(120, 0.2, function () {
$(this).attr({ src: src, alt: $link.find('img').attr('alt') }).fadeTo(120, 1);
});
$link.addClass('current').siblings().removeClass('current');
});gallerythumbnailsimagesclick