【问题标题】:jquery multi level menujquery多级菜单
【发布时间】:2013-03-06 14:33:24
【问题描述】:

大家好 我创建了一个基于 jquery 的多级导航菜单,当 onMouse 每个子导航直接出现在悬停/单击的列表项下方时。我现在遇到的问题是所选父项的 bg-color 没有像 subnav bg 一样改变。奇怪的是它在 IE 中而不是在 FF 中工作。这是我写的jquery脚本。

演示 - http://jsfiddle.net/pixelfx/xRVVv/4/

  $(document).ready(function() {
  $("ul#topnav li").hover(function() { //Hover over event on list item
  $(this).css({ 'background' : '#1376c9 url(topnav_active.gif) repeat-x'}); 
  $("ul#topnav li.active1").css({ 'background' : 'CCFFCC'}); 
  $(this).find("span").show(); //Show the subnav

  } , function() { //on hover out...
  $(this).css({ 'background' : 'none'}); 
  $(this).find("span").hide(); //Hide the subnav
  $(this).find("span.active").show(); //Hide the subnav
  $(this).find("li.active1").show(); //Hide the subnav
 $("li.active1").css({ 'background' : '1376c9'}); 
 });});

【问题讨论】:

    标签: jquery css menu


    【解决方案1】:

    .css({ '背景' : 'CCFFCC'});

    .css({ '背景' : '1376c9'});

    您在颜色之前缺少#mark.. 添加它有帮助吗?

    OK 编辑了一个小提琴,更正了颜色代码并得到了我认为你想要的,即 active1 选项卡保持突出显示,除非其他选项卡悬停在上面..

    这就是你想要的 - jsfiddle

    【讨论】:

    • :( 我看到它为我纠正了颜色,但没有纠正动作,我用小提琴更新了帖子
    猜你喜欢
    • 2015-08-02
    • 1970-01-01
    • 2015-07-22
    • 2017-02-18
    • 1970-01-01
    • 2013-01-29
    • 2014-07-25
    • 2012-05-25
    • 2015-06-07
    相关资源
    最近更新 更多