Peter Higginbotham

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromPeter Higginbotham
ToMe
SubjectNested list collapsing script - expanding section & highlighting an entry
Date7 October 2006 22:52
Hi Mark,
I'm very much a Javascript novice but have been making great progress with
your excellent nested list collapsing script (v2.30).
I'm trying to use the script in a frames environment, with the script in a
sidebar frame and the menu selections displayed in a separate content frame.
I know frames are deprecated but I hope you'll bear with me!

All works absolutely fine for basic page selection - I use a <BASE="> tag to
specify the target frame. I'm not using any prefix characters to the menu
entries, just color and indentation to indicate the sub-levels.

I'd like to use the script's facility to auto-open and highlight the
currently selected entry.
First, is there a way to simply highlight the currently selected menu entry
by some means in my frames context.e.g. could the name of the content frame
be specified as a parameter somewhere as the one to be examined by the
selflLink rather than defaulting to the current window?

Secondly, I'm trying to cope with the situation where a content-page has
benn loaded directly and bypassing the frame setup. I can do this by
redirecting the request (via a small piece of code at the head of each
sub-page)  to to a top-level page which loads the frameset plus the menu and
the requested content-page. In this situation I'd again like to be able to
open up the menu to the appropriate section , maybe by passing it the
content-page filename (or menu text) rather than it auto-detecting it as it
does in your examples where the menu is embedded in the content-page itself.

One separate issue - like many others in your mail archive, I've found that
using links in menu-section parent entries generates problems. In IE, I get
the extra blank line others have described but haven't been able to decide
from your replies whether this is an insoluble problem or whether changing a
style definition should fix it. Is the "li { display: inline; } /* fix for
IE blank line bug */" in your sample code supposed to take care of the
problem? It doesn't for me, neither does adding a STYLE="display:inline;"
code to the menu entry itself. In Firefox (current release) parent lines
with links in them don't generate the extra blank line, but neither do they
expand their contents when clicked.


Sorry this has turned out so long. Any help much appreciated.
Regards
Peter Higginbotham
FromMe
ToPeter Higginbotham
SubjectRe: Nested list collapsing script - expanding section & highlighting an entry
Date10 October 2006 22:37
Peter,

> could the name of the content frame be specified as a parameter somewhere
> as the one to be examined by the selflLink rather than defaulting to the
> current window?

The latest version of the script allows you to pass a URL to selfLink, and
it will look for that instead.

Each page that loads can call the selfLink function through the frames
collection of the parent frame.

When you open the frameset after a page that has been loaded without it
(something I recommend you do not automate, since it breaks accessibility
horribly - just provide a link for them to request the frameset), you will
have timing issues, so check if the navigation frame has opened yet, and if
so, run the script immediately. If not, store a variable in the parent, and
have the navigation frame check for it onload, and select the appropriate
page if it finds that variable.

> In IE, I get the extra blank line others have described but haven't been
> able to decide from your replies whether this is an insoluble problem or
> whether changing a style definition should fix it.

You have probably used display:block; on the 'a' elements. When you have a
link in a branch heading, the script puts a second link there to
expand/collapse, meaning that two links both have display:block; so each is
put on its own line.

If you want to have links in branch headings, you cannot use display:block;
on the links (you can also remove that IE blank line fix, since it is only
there to fix a bug that appears when you use display:block;).

> In Firefox (current release) parent lines with links in them don't
> generate the extra blank line, but neither do they expand their contents
> when clicked.

And what does Opera do? Opera's behaviour is much more useful when
debugging. Tell me what appears in Opera's in Opera's error console when you
try to expand/collapse.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.