我已經創建了一個我正在建設的網站的首頁的菜單,其中有8個按鈕,如下所示。 我已經寫了一點點jQuery,導致所有的菜單項不透明度與正在徘徊的項目不同。 這裏是我的代碼:jQuery懸停效果觸發其他列表項目
HTML:
<div class="row-fluid" id="home_page_icons">
<div class="span12">
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">News & Events</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Facilities</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Membership</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Pay As You Play</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Health & Fitness</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Exercise Classes</a>
<a href="<?php echo JURI::root() . 'index.php/news-events' ?>">Children's Activities</a>
<a class="last" href="<?php echo JURI::root() . 'index.php/news-events' ?>">Lane 9 Cafe</a>
</div>
</div>
的jQuery:
jQuery('#home_page_icons div a').hover(function() {
jQuery(this).siblings().fadeTo("fast", 0.3);
},
function() {
jQuery(this).siblings().fadeTo("fast", 1.0);
})
我還創建了一個的jsfiddle顯示我的問題:
當你懸停在一個菜單項上它工作正常(所有其他r項目會改變不透明度),但是如果您將鼠標懸停在菜單項之間,則說明最左側和最右側之間的所有項目的動畫都會被激活,從而導致閃爍效果。
有沒有人有任何想法ot指示我如何解決這個問題? 感謝
那很簡單!非常感謝! :) – devoncrazylegs
@funkyjimbob不用擔心,很高興它有幫助。 – boz