私が構築しているサイトのフロントページ用に、以下に示すように8つのボタンを持つメニューを作成しました。ホバーされているアイテムとは別に、すべてのメニューアイテムの不透明度を変更する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を作成しました。
メニュー項目にカーソルを合わせると正常に機能します(他のすべての項目の不透明度が変わります)が、メニュー項目間、たとえば左端と右端の間でカーソルを合わせると、間にあるすべての項目のアニメーションがアクティブになり、点滅効果が発生します。
私がこの問題をどのように解決するかについて、誰かが何かアイデアを持っていますか?ありがとう