Skip to content

Instantly share code, notes, and snippets.

@s-hiroshi
Created February 13, 2012 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s-hiroshi/1814627 to your computer and use it in GitHub Desktop.
Save s-hiroshi/1814627 to your computer and use it in GitHub Desktop.
jQuery > simple slide show
// シンプルなスライドショー
// 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