开发者

Disappearing after mouse out menu with jQuery/WordPress

i have altered the script for jQuery menu in wordpress, and everything works fine except the menu item is not removing itself after mouse out. It remains over another selected menu item. My question is - if anyone can help mw with adding mouse out effect on this menu? here is the code

jQuery(document).ready(function() {

jQuery("#nav ul.sub-menu").hide();

jQuery('li:has(ul.sub-menu)').children('a').click(function (e) {
    e.preventDefault();     
    jQuery(this).parent('li').find('ul:first').fadeToggle(1000);

});

var currentMenuItem = jQuery('.current-menu-item');
var currentMenuItemText = currentMenuItem.tex开发者_JS百科t();
currentMenuItem.remove('a');
currentMenuItem.text(currentMenuItemText);
jQuery('.current-menu-item').parent('ul:first').show();


});


Your menu is set to hide when you click again. To use the mouseout to hide it, it should look like:

jQuery('li:has(ul.sub-menu)').children('a').click(function (e) {
    e.preventDefault();     
    jQuery(this).parent('li').find('ul:first').fadeIn(1000);
}).mouseout(function(){
    jQuery(this).parent('li').find('ul:first').fadeOut(1000);
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜