【发布时间】:2015-07-06 13:31:03
【问题描述】:
我想创建一个 dropdwon 菜单,就像 Edinburgh Zoo 网站上的菜单一样,它在运行时会在后台淡出页面。
到目前为止。jsfiddle我不知道如何让背景褪色,有什么想法吗?
var stop = true;
var hovered;
var timeout;
$('.nav').hover(
function(){
clearTimeout(timeout);
stop = true;
hovered = this;
timeout = setTimeout(function(){
if($(hovered).hasClass('nav_menu_link_drop')){
$('.content').css('z-index',0);
$(hovered).next('.content').css('z-index',5);
$(hovered).next('.content').slideDown(350);
timeout = setTimeout(function(){
$('.content').not($(hovered).next('.content')).slideUp(350);
},200);
}
else
$('.content').slideUp(350);
},400);
},
function(e){
stop = false;
clearTimeout(timeout);
setTimeout(function(){
if(!stop)
$('.content').slideUp(350);
},500);
}
);
$('.content').hover(
function(){
stop = true;
},
function(){
}
);
$('#nav_menu').hover(
function(){
},
function(){
timeout = setTimeout(function(){
$('.content').slideUp(350);
},200);
}
);
【问题讨论】:
标签: javascript jquery css drop-down-menu fadeout