Created
February 13, 2012 07:32
-
-
Save s-hiroshi/1814627 to your computer and use it in GitHub Desktop.
jQuery > simple slide show
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
// シンプルなスライドショー | |
// photo-main メイン画像コンテナ | |
// photo-thumb サムネイルコンテナ | |
$('#photo-thumb a').click(function() { | |
$('#photo-main img').hide(); | |
var path = $(this).attr('href'); | |
var img = new Image(); | |
img.src = path; | |
// 画像をスムーズに切り替えるために一度removeしてからappendする。 | |
$('#photo-main img').remove(); | |
$('#photo-main').append(img); | |
$('#photo-main img').css({ | |
display: "none" | |
}); | |
$('#photo-main img').fadeIn('fast'); | |
return false; | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment