Daniel Jacobsohn

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromDaniel Jacobsohn
ToMe
Subjectquestion about previous email thread
Date25 September 2006 22:33
http://www.howtocreate.co.uk/emails/SteveNelson2.html

Hello,

I am interested in the same effect (some of my <li> links containing a
submenu should also be a link).  The desired effect can be described using
the following sample:
          <li>menu A
               <ul>
                    <li><a href="a1.html">a1</a></li>
                    <li><a href="a2.html">a2</a></li>
               </ul>
          </li>

          <li><a href="B.html">menu B</a>
               <ul>
                    <li><a href="b1.html">b1</a></li>
                    <li><a href="b2.html">b2</a></li>
               </ul>
          </li>

          <li>menu C
               <ul>
                    <li><a href="c1.html">c1</a></li>
                    <li><a href="c2.html">c2</a></li>
               </ul>
          </li>

If I click on 'menu A' or 'menu C', the normal behavior should occur (the
menu should expand).  If I click on menu B, instead of expanding, it should
go to B.html, and once on B.html, the submenu should expand, and B.html
should be highlighted.

I tried using the extra function you wrote in the previous thread but to no
avail.

Is my desired behavior possible?

Thank you in advance for any & all help.
-Dan J.
FromMe
ToDaniel Jacobsohn
SubjectRe: question about previous email thread
Date28 September 2006 21:48
Daniel,

> If I click on 'menu A' or 'menu C', the normal behavior should occur (the
> menu should expand).  If I click on menu B, instead of expanding, it should
> go to B.html, and once on B.html, the submenu should expand, and B.html
> should be highlighted.

The script can do this with your current setup. Since you already have the
link in place, it will remain a normal link to the page. The script will add
an extra +/- link before it, but you can set that to an empty string when
you call compactMenu, and the script will create an empty link, so it will
not be visible (the other links it creates will all contain the text of the
LIs so they will continue to expand/collapse).

Now, on B.html, you can collapse the menu, then use selfLink to assign a
highlight class to the B.html link (without expanding it), and then again to
expand the menu to show a _child_ link, such as b1.html or b2.html.
Something like this should do it:

Starting page;

<script type="text/javascript">
window.onload = function () {
  compactMenu('someID',false,'');
}
</script>

B.html;

<script type="text/javascript">
window.onload = function () {
  compactMenu('someID',false,'');
  selfLink('someID','selfhighlight',false);
  selfLink('someID','',true,'foo.html');
}
</script>

That should work, I think. Completely untested of course ;)


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromDaniel Jacobsohn
ToMe
SubjectRe: question about previous email thread
Date29 September 2006 22:53
Thank you for the comments.  I've made some customizations to the script
that (I think) also fix the problem for the way I envisioned it.  Feel free
to take a look.  I'll also include a non-authorized section of our staging
server for you to look at the results.

I've been a programmer for years, but have never had the 'pleasure' of
hacking the DOM (usually I developed non-visual apps).  It was, well,
different.

[URL]

Link & Menu:
[URL]
'Traditional' behavior:
[URL]

Have a lovely weekend.

Cheers,
Dan J.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.