Created
August 29, 2010 02:42
-
-
Save jdlich/555892 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Gallery Script | |
// | |
// first thumbnail starts out as being selected | |
$('#photo_gallery ul li:first-child img').addClass('selected'); | |
// set the last thumbnail's margin to 0 | |
$('#photo_gallery ul li:last-child').addClass('last'); | |
// all thumbnails should begin with lower opacity | |
$('#photo_gallery ul img').animate({ opacity: 0.75 }).hover( | |
// on mouseover: | |
function(e) { | |
var thumbnail = $(e.target); | |
// remove selected status from all thumbnails | |
thumbnail.parent().siblings().children().removeClass('selected'); | |
// change opacity back to 100% | |
thumbnail.stop().animate({ opacity: 1 }, "fast"); | |
// select thumbnail | |
thumbnail.addClass('selected'); | |
// update image with thumbnail image | |
var new_photo = thumbnail.attr('src').replace('_thumbnail',''); | |
$('#photo_gallery img#main').attr('src', new_photo); | |
}, | |
// on mouseout: | |
function(e) { | |
// drop opacity back down to 75% | |
$(this).stop().animate({ opacity: 0.75 }); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment