views:

316

answers:

1

Hi There,

I am working on a two-level menu like the Dynamic Drive examples on this page. The goal is to show a subnav layer below the main nav onmouseover, reverting to each page's default subnav layer after a timed interval. It works, except for a big problem: I am using sIFR on the main navigation items (<a>s inside of <li>s). The script logic doesn't work on the sIFRized items, because it targets <a rel=""> tags, which have been replaced.

I tried changing the script to target the parent <li>s, but it just screwed up the main nav. I am not very advanced with Javascript so any advice is appreciated!

One idea: is it possible to sIFR replace each navigation <a> instead of replacing each <li>? Or would the <a rel=""> still be unavailable to the menu script?

I'm not married to this javascript solution, in fact I tried a few other methods of my own using simple Javascript show/hide methods. However, this script has the "reverting to default" behavior I am looking for.

--> Javascript menu source from Dynamic Drive

• Main navigation source:

<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 replacement for main nav items

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 source (a separate code snippet)

<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>
A: 

Seriously, save yourself the trouble and don't use sIFR here.

Mark Wubben
I'll rethink it.
Marcy Sutton