我有以下 javascript 代码,每次用户将鼠标放在缩略图上时,都会将 div 中的图像更改为不同的图像。
我的问题是,如何应用淡入效果使图像变化更好?
谢谢
JS:
$('#thumbs').delegate('img', {
mouseover: function(){
$('.mainImage').attr('src',$(this).attr('src').replace('thumb','image'));
var $this = $(this),
index = $this.index();
$("#thumbs img").removeClass('thumbSelected');
$this.addClass('thumbSelected');
}});
PHP:
<div id="thumbs">
<img class="thumbSelected" src="http://www.tahara.es/images/<?php echo $row2[thumb1]; ?>.jpg" /><br />
<img src="http://www.tahara.es/images/<?php echo $row2[thumb2]; ?>.jpg" /><br />
<img src="http://www.tahara.es/images/<?php echo $row2[thumb3]; ?>.jpg" />
</div>
<div class="mainImage magnify">
<div class="large"></div><a href="http://www.tahara.es/images/<?php echo $row2[image1]; ?>.jpg" rel="lightbox" title="<?php echo $row2[name]; ?>">
<img class="mainImage small" src="http://www.tahara.es/images/<?php echo $row2[image1]; ?>.jpg" />
</a>
</div>