1
所以我寫了這麼一小段代碼來嘗試一些用於預加載的圖像交換的新方法,並且我遇到了一些麻煩。Jquery Mouseenter/Mouse圖片交換
我的問題是,我對此有一些填充和文本圖像的容器,但我的側翻激活只有當有人滾動,而不是容器在圖像上發生。我必須有一些小錯,希望有人能幫助我。仍在學習!
下面是HTML:
<div class="projectThumb">
<img src="/img/aeffect_button_static.gif" width="146" height="199" class="static" name="aeffect" alt="" />
<img src="/img/aeffect_button_rollover.jpg" width="146" height="199" class="rollover" name="aeffect" alt="" />
<p class="title">A.EFFECT: Film Poster</p>
</div>
這裏是jQuery的:
$(document).ready(function(){
$(".rollover").hide();
$(".projectThumb").mouseenter(
function(){
$(this).attr(".static").hide();
},
function(){
$(this).attr(".rollover").show();
});
$(".projectThumb").mouseleave(
function(){
$(this).attr(".rollover").hide();
},
function(){
$(this).attr(".static").show();
});
});