jQuery nav-need在child hover-jsfiddle上显示孙子链接
我的导航90%正常工作,但在子导航链接悬停后,我很难让我的孙子(第三导航)显示 以下是我到目前为止掌握的一些知识: 仅供参考:“关于”下的每个子链接当前都有一个孙子链接用于测试jQuery nav-need在child hover-jsfiddle上显示孙子链接,jquery,navigation,Jquery,Navigation,我的导航90%正常工作,但在子导航链接悬停后,我很难让我的孙子(第三导航)显示 以下是我到目前为止掌握的一些知识: 仅供参考:“关于”下的每个子链接当前都有一个孙子链接用于测试 <script type='text/javascript'> jQuery(document).ready(function($){ var lastopen = null; var timeout = null;
<script type='text/javascript'>
jQuery(document).ready(function($){
var lastopen = null;
var timeout = null;
jQuery("#access ul li ul").show();
jQuery("#access ul li ul li").hide();
function showmenu(element)
{
element.css("background","url('/var/www/wp-content/themes/GreatWall/images/arrow.png') no-repeat bottom");
// var children = element.find("ul li");
var children = element.children('ul').children('li')
children.show();
}
function hidemenu(element, fade)
{
element.css("background","transparent");
var children = element.find("ul li");
fade = typeof(fade) != 'undefined' ? fade : false;
if(fade)
{
children.fadeOut(300);
}
else
{
children.hide();
}
}
jQuery("#access ul li").each(function(i,v){
jQuery(v).mouseover(function(e){if(timeout != null){clearTimeout(timeout); timeout = null;} if(lastopen != null){hidemenu(lastopen);} lastopen = jQuery(this); showmenu(lastopen);});
jQuery(v).mouseout(function(e){if(timeout != null){clearTimeout(timeout); timeout = null;} timeout=setTimeout(function(){hidemenu(lastopen, true); lastopen = null;},1500);});
});
//jQuery("#access ul li ul").css("display", "block");
//jQuery("#access ul li").each(function(i,v){var width = 0; jQuery(v).find("ul li").each(function(ii,vv){width += jQuery(vv).width();}); var mid = jQuery(v).position().left+jQuery(v).width()/2-width/2; jQuery(v).find("ul li:first").css("margin-left", Math.min(Math.max(0, mid), 940-width));});
//jQuery("#access ul li").each(function(i,v){var width = 0; jQuery(v).find("ul li").each(function(ii,vv){width += jQuery(vv).width();}); var mid = jQuery(v).position().left; jQuery(v).find("ul li:first").css("margin-left", Math.min(Math.max(0, mid), 940-width));});
//jQuery("#access ul li ul").css("display", "none");
});
</script>
jQuery(文档).ready(函数($){
var lastopen=null;
var超时=null;
jQuery(“#访问ul li ul”).show();
jQuery(“#访问ul li”).hide();
功能显示菜单(元素)
{
css(“背景”,“url('/var/www/wp-content/themes/GreatWall/images/arrow.png')无重复底部”);
//var children=element.find(“ul li”);
var children=element.children('ul').children('li'))
children.show();
}
函数hidemenu(元素,淡入淡出)
{
css(“背景”、“透明”);
var children=element.find(“ul li”);
褪色=类型(褪色)!=“未定义”?褪色:假;
如果(褪色)
{
儿童。渐弱(300);
}
其他的
{
儿童。隐藏();
}
}
jQuery(“访问ul li”)。每个(函数(i,v){
函数(e){if(timeout!=null){cleartimout(timeout);timeout=null;}if(lastopen!=null){hidemenu(lastopen);}lastopen=jQuery(this);showmenu(lastopen);});
jQuery(v).mouseout(函数(e){if(timeout!=null){clearTimeout(timeout);timeout=null;}timeout=setTimeout(函数(){hidemenu(lastopen,true);lastopen=null;},1500);});
});
//jQuery(“#access ul li ul”).css(“display”、“block”);
//jQuery(“#access ul li”).each(函数(i,v){var width=0;jQuery(v).find(“ul li”).each(函数(ii,vv){width+=jQuery(vv.width());var mid=jQuery(v.position().left+jQuery(v.width()/2-width/2;jQuery(v.find)).css(margin left),Math.min(Math.max(0,mid),940 width));
//jQuery(“#access ul li”).each(函数(i,v){var width=0;jQuery(v).find(“ul li”).css(函数(ii,vv){width+=jQuery(vv.width());var mid=jQuery(v.position().left;jQuery(v).find(“ul li:first”).css(“margin left”,Math.min(Math.max(0,mid),940 width));
//jQuery(“#access ul li ul”).css(“display”、“none”);
});
任何帮助都将不胜感激!提前感谢尝试以下脚本:
这就是你想要的:
jQuery(document).ready(function ($) {
$('.menu li').each(function(){
$(this).hover(function(){
$('> ul',this).show();
},function(){
$('> ul',this).delay(1000).fadeOut();
});
});
});
哈,难以置信!我肯定欠你一杯啤酒。谢谢你,杰夫!你真是一个好人,是的,在印度等啤酒。你知道为什么这不会用jquery-1.7.1在IE 8或更低版本中显示孙子孙女吗??在其他浏览器中都能完美工作