「javascript/gallery」の編集履歴(バックアップ)一覧に戻る

javascript/gallery - (2016/01/15 (金) 17:16:48) のソース

#js(){{{{{
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script>
$(function() {
	var slider = $('#gallery .slideFrame p');
	var img = $('#gallery .slideFrame p img');
	var imgW = img.width();
	var imgM = parseInt(img.css('margin-right'));
	var sliderWidth = (imgW + imgM) * img.length;
	var imgID = 1;
	slider.css('width', sliderWidth);
	//console.log(sliderWidth);
	
	$('#gallery input').click(function() {
		if ($(this).is('input')){
			imgID = $(this).index() + 1;
		}
		//console.log(imgID);
		slider.animate({left: -(imgW + imgM) * (imgID - 1) + 10 }, 1000);
	});
});
</script>
}}}}}
#html2(){
	<input type="radio" id="switch1" name="gallery" checked="checked">
	<input type="radio" id="switch2" name="gallery">
	<input type="radio" id="switch3" name="gallery">
	<input type="radio" id="switch4" name="gallery">
}