2012-04-04 37 views
2

我有一個在最後一個li li的ul列表,它有id #search - 我不希望下拉applid這個,我怎麼能排除它?這裏是我的代碼..jQuery - 從這個函數中排除李?

$(document).ready(function() {  
    $('#navigation li').hover(function() { 
    // Show the sub menu 
    $('ul', this).stop(true,true).slideDown(300); 
    }, 
    function() { 
    //hide its submenu 
    $('ul', this).stop(true,true).slideUp(200);   
    }); 
}); 

感謝

回答

5

使用jQuery的.not()

$('#navigation li').not("#search").hover(function() { 
    // Show the sub menu 
    $('ul', this).stop(true,true).slideDown(300); 
}, 
function() { 
    //hide its submenu 
    $('ul', this).stop(true,true).slideUp(200);   
});