当我点击 rightButton 时,RightMove LargeImage 和 smallimage 有效
如何使用Jquery和javascript帮助我建议......
<div class="largethumb">
<img src="http://img.tjskl.org.cn/pic/z2577d9d-200x200-/pinarello_lungavita_2010_single_speed_bike.jpg" alt="item" />
<a class="left" href="#"> Left </a>
<a class="right" href="#"> right </a>
</div> <!-- End largeImage -->
<div class="thumbgallery clearfix">
<div class="thumb active">
<a href="http://img.tjskl.org.cn/pic/z2577d9d-200x200-1/pinarello_lungavita_2010_single_speed_bike.jpg">
<img src="http://img.tjskl.org.cn/pic/z2577d9d-200x200-1/pinarello_lungavita_2010_single_speed_bike.jpg"/>
</a>
</div>
<div class="thumb">
<a href="http://sstatic.net/stackoverflow/img/tag-android.png">
<img src="http://sstatic.net/stackoverflow/img/tag-android.png"/>
</a>
</div>
<div class="thumb">
<a href="http://sstatic.net/stackoverflow/img/tag-android.png">
<img src="http://sstatic.net/stackoverflow/img/tag-android.png"/>
</a>
</div>
<div class="thumb">
<a href="http://img.tjskl.org.cn/pic/z2577d9d-200x200-1/pinarello_lungavita_2010_single_speed_bike.jpg">
<img src="http://img.tjskl.org.cn/pic/z2577d9d-200x200-1/pinarello_lungavita_2010_single_speed_bike.jpg" alt="item" />
</a>
</div>
</div> <!-- End thumbgallery -->
jquery的
$(".thumbgallery .thumb a").click(function(e) {
$(this).parents('.thumb').addClass("active").siblings().removeClass('active');
var href = $(this).attr("href");
$(".largethumb img").attr("src",href);
e.preventDefault();
return false;
});
$(".largethumb a.left").click(function(){
<!-- how use laregimage move and smallimage is active -->
});
$(".largethumb a.right").click(function(){
<!-- how use laregimage move and smallimage is active -->
});
答案 0 :(得分:1)
嗯,这也可以通过CSS3完成,为什么要使用jquery ...
.thumbgallery { }
.thumbgallery .thumb { /* Code For left*/ }
.thumbgallery .thumb:nth-child(odd) { /* Code For right*/ }
希望这个想法对你有用.....