News
替换sub-nav
mouseleave 上的菜单,虽然它按预期工作,但如果您快速移动父项目,切换非常分散注意力,有时新闻和子导航相互重叠。
$('#nav > ul > li').mouseover(function () { // on mouseover
if ($(this).has(".children").length) { // if has submenu
$('#news').slideUp(); // hide ticker
$(this).parent().find(".children").not($('.children', this)).hide(); // hide other submenus
$('.children', this).slideDown(); // show current
} else {
$(this).parent().find(".children").not($('.children', this)).hide();
$('#news').slideDown();
}
});
$('#nav .children').mouseleave(function (e) { // on mouseleave
var $children = $(this);
setTimeout(function(){ // after a whilte
$children.slideUp(); // hide current submenu
$('#news').slideDown(); // show ticker
},4000);
e.stopPropagation();
});