2012-04-04 77 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);   
});