2012-07-03 45 views
0

不止一個類我有以下腳本,動畫在我的導航項目的背景圖像精靈:剔除懸停功能

$j(function() { 
    $j(".menu-item:not(.current-menu-item) .bottom_nav").hover(function() { 
     $j(this).animate({ 
     backgroundPosition : '0px 35px'} 
     , 300); } 
    , function() { 
     $j(this).animate({ 
     backgroundPosition : '0px 0px'} 
     , 600); } 
    ); 
}); 

我現在想從懸停腳本排除第二類。我曾嘗試將它的形式:

$j(".menu-item:not(.current-menu-item, .current-menu-parent) .bottom_nav").hover(function() { 

$j(".menu-item:not('.current-menu-item, .current-menu-parent') .bottom_nav").hover(function() { 

但雙雙突破懸停腳本。

回答

2

jQuery的。不()/:沒有選擇器documentation -

的。不是()方法將結束爲您提供比推複雜的選擇或變量成更可讀 選擇:否() 選擇器過濾。在大多數情況下,這是一個更好的選擇。

$j(".menu-item").not(".current-menu-item,.current-menu-parent").find(".bottom_nav").hover() 
+0

謝謝,這樣做的工作 – Nick