透明覆蓋層基本上我有4張圖片設置了這樣的div:jQuery的:懸停
<div id="selector">
<div id="1"><div class="folio_container pk"><div class="overlay"></div></div></div>
<div id="2"><div class="folio_container ybn"><div class="overlay"></div></div></div>
<div id="3"><div class="folio_container u"><div class="overlay"></div></div></div>
<div id="4"><div class="folio_container more"><div class="overlay"></div></div></div>
<div class="clearfloat"></div>
</div>
而CSS:
.folio_container{margin:10px 80px 10px 15px; float:left; position:relative; cursor:pointer; -moz-border-radius: 8px; -webkit-border-radius: 8px; background-position:top left; background-repeat:no-repeat; width:80px; height: 80px;}
.pk{ background-image:url(../images/pk_icon.png) !important;}
.ybn{ background-image:url(../images/ybn_icon.png) !important;}
.u{ background-image:url(../images/u_icon.png) !important;}
.more{ background-image:url(../images/more_icon.png); margin:10px 0px 10px 15px !important;}
.overlay{ background-image:url(../images/overlay.png); background-position:top left; -moz-border-radius: 8px; -webkit-border-radius: 8px; background-repeat:no-repeat; width:80px; height:80px; position:absolute; top:0px; left:0px; display:none;}
我怎樣才能讓我的Jquery,使其淡入每個單獨懸停的懸停的疊加,我一直對這個想法感到困惑,因爲看到div類是相同的,它不會同時觸發它們嗎?
繼承人的jQuery的迄今:
$('.overlay').css('display', 'block');
$('.overlay').css('opacity', 0.0);
$('folio_container', this).hover(function() {
$(this).children('.overlay', this).stop().animate({opacity:1.0},500);
},
function() {
$(this).children('.overlay', this).stop().animate({opacity:0.0},500);
});
某些反問題和註釋: - 爲什麼需要雙嵌套div?你已經給父母兩個班,一個普通和一個特定 - 你的懸停在folio_container上工作,但不應該這樣.folio_container? – Ferdy 2009-12-18 15:40:30
是的,這是錯字我意外丟下了句號! :)和外部的div是我使用單獨的jquery觸發的選項卡! – 2009-12-19 18:08:08