2013-01-07 55 views
0

我有jQuery的問題。我創建了一個功能.click的菜單,但現在我需要在懸停菜單中轉換此菜單,當我點擊鏈接COLLECTIONS時。jQuery從點擊變爲懸停

這是jQuery代碼:

$(document).ready(function(){ 
    $("div#toggle a.button").click(function() { 
    $("div#toggle div.box").toggle("slow"); 
}); 
hidden = true; 
$("div#custom a.button").hover(function() { 
    if(hidden == false) { 
    $("div#custom div.box").fadeOut(); 
    hidden = true; 
    } else { 
    $("div#custom div.box").fadeIn(100); 
    hidden = false; 
    } 
}); 

這是CSS代碼:

#custom { 
    z-index:0; 
} 

.box { 
    width:100%; 
    height:20px; 
    border:0px solid #999; 
    background-color:rgb(128, 129, 132); 
    display:none; 
    position:fixed; 
    left:0; 
    margin-top:6px; 
    z-index:0; 
    font-family:Arial, Helvetica, sans-serif; 
    font-size: 10px; 
    color:#E6E4D7; 
} 

的頁面是在http://www.mediaxsrl.it/web/loloey/forme/formeit.html

+1

和你的問題是什麼? – povilasp

+0

有一種方法可以在不改變css的情況下適應jquery代碼? –

+0

任何人都可以解決這個問題? –

回答

0

試試這個

$("#custom").hover(function() { 
    $(this).find("box").slideDown(); 
} , function() { 
    $(this).find("box").hide(); 
}); 
+0

我用我的代碼或部分代碼替換我的代碼? –

+0

把它放在文件準備好,並刪除所有其他代碼 –

+0

我嘗試它,但當我將鼠標移出鏈接集合,並進入子菜單子菜單消失。 –