代码之家  ›  专栏  ›  技术社区  ›  Marcy Sutton

带sifr的javascript选项卡菜单

  •  0
  • Marcy Sutton  · 技术社区  · 15 年前

    我正在研究一个两级菜单,如动态驱动器示例 this page . 目标是在主导航下面显示一个子导航层 onmouseover ,在一个时间间隔后恢复到每个页面的默认子导航层。除了一个大问题:我在主要的导航项目上使用SIFR( <a> 内部的 <li> s)。脚本逻辑不适用于已分类的项,因为它以 <a rel=""> 标签,已被替换。

    我试图更改脚本以锁定父级 <理工大学; 但是它把主导航系统搞砸了。我对javascript不是很在行,所以任何建议都会受到赞赏!

    一个想法是:是否可以用SIFR代替每个导航系统? <A & GT; 而不是更换每一个 <理工大学; ?还是会 <一个Re=“”& Gt; 菜单脚本仍然不可用?

    我没有和这个javascript解决方案结婚,事实上,我尝试了其他一些我自己的方法,使用简单的javascript显示/隐藏方法。但是,这个脚本有我正在寻找的“恢复为默认”行为。

    --> Javascript menu source from Dynamic Drive

    _穖主要导航源:

    <div id="mainNav">
    <ul>
        // rel="subnav1" shows the "subnav1" layer in the snippet below
        <li class="navLi"><a href="around-othello.php" rel="subnav1">Around Othello</a></li>
    
        // rel="subnav2" shows the "subnav2" layer in the snippet below
        <li class="navLi"><a href="living-here.php" rel="subnav2">Living Here</a></li>
    
        // rel="subnav3" shows the "subnav3" layer in the snippet below
        <li class="navLi"><a href="link-to-it.php">Link to it</a></li>
    
        <li class="navLi"><a href="whats-new.php">What's New</a></li>
    
        <li class="navLi"><a href="contact.php">Contact</a></li>
    
        <li class="navLi"><a href="retail.php">Retail Hub</a></li>
    </ul>
    </div>
    

    __主要导航项目的SIFR替换

    sIFR.replace(grotesqueMT, {
    selector: 'li.navLi',
    tuneWidth:4,
    forceSingleLine:true,
    ratios:[8, 1.3, 11, 1.21, 12, 1.2, 14, 1.19, 21, 1.16, 28, 1.13, 38, 1.12, 61, 1.11, 94, 1.1, 95, 1.09, 103, 1.1, 107, 1.09, 110, 1.1, 119, 1.09, 120, 1.1, 1.09],
    css: ['.sIFR-root { background-color:#5a7e92; color:#ffffff; font-size:18; }'
          ,'a { color:#ffffff; text-decoration:none; }'
          ,'a:link { color:#ffffff; text-decoration:none; }'
          ,'a:hover { color:#f0eed6; text-decoration:underline; }'
          ]
    });
    

    __Subnav源(单独的代码段)

    <div id="subnav1" class="subnav">
    <ul>
        <li><a href="around-othello.php">Around Othello</a></li>
        <li class="pipe"> | </li>
        <li><a href="around-othello.php?p=your-big-backyard">Your Big Backyard</a></li>
        <li class="pipe"> | </li>
        <li><a href="around-othello.php?p=explore-the-area">Explore the Area</a></li>
        <li class="pipe"> | </li>
        <li><a href="communityBuzz">Community Buzz</a></li>
    </ul>
    </div>
    
    <div id="subnav2" class="subnav">
    <ul>
        <li><a href="around-othello.php">Around Othello</a></li>
        <li class="pipe"> | </li>
        <li><a href="communityBuzz">Community Buzz</a></li>
    </ul>
    </div>
    
    <div id="subnav3" class="subnav">
    <ul>
        <li><a href="living-here.php">Living Here</a></li>
        <li class="pipe"> | </li>
        <li><a href="living-here.php?p=living-green">Living Green</a></li>
    </ul>
    </div>
    
    1 回复  |  直到 15 年前
        1
  •  0
  •   Mark Wubben    15 年前

    推荐文章