我有以下JavaScript代碼,每當用戶將鼠標放在縮略圖的頂部時更改不同的div中的圖像。添加淡入效果到剛加載使用javascript的圖像
我的問題是,我如何應用淡入效果,使圖像變化更好?
感謝
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>
RTLM更好:http://api.jquery.com/fadeIn/ – 2013-02-17 03:23:20