2011-07-24 16 views
1

私はjqueryスライドショーを作成しています。メインスライドを左右に自動的に回転させ、サムネイルをクリックして画像を回転することもできます。次/前ボタン画像をjQueryスライドショーに追加

メインスライドの左側と右側の両方に矢印の画像を配置します。クリックすると、その方向にスライドショーが回転します。

答えて

0

ここは始まりです。現在の画像が表示されているもののグローバル変数を保持する必要があります。次に、その変数とデータベース内のイメージリストとの間のマッピングを行います。

<head> 
<title>Untitled Document</title> 
<script src="jquery-1.6.2.js"></script> 
<script> 

$(document).ready(function() { 

    $("#buttonLeft").click(function(){ 
     $("#image1").attr('src','http://scm-l3.technorati.com/11/05/04/33025/obama1.jpg?t=20110504183038'); 
    }); 

    $("#buttonRight").click(function(){ 
     $("#image1").attr('src','http://faculty.smu.edu/rblair/Bush.jpg'); 
    }); 

}); 

</script> 

</head> 
<body> 

<button id="buttonLeft" type="button">&lt;==</button><button id="buttonRight" type="button">==&gt;</button> 
<br /><br /> 
<img id="image1" src='http://www.google.com/intl/en_com/images/srpr/logo2w.png' /> 


</body> 
</html> 
関連する問題