Eustace

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromEustace
ToMe
SubjectlistCollapse.js (minor) bug
Date10 December 2009 17:35
Hi!

Thanks for your listCollapse.js! It works as expected, except that there is
a small bug when dealing with long lists _and_ a list is left open when
another list opens.

Please go to the following link:

[URL]

The page is in Greek and also the links are missing but that doesn't matter.
To see what I mean, click list 3 on the sidebar. A long list of scans opens.
Now scroll down to find and click link 30. Another list opens _but_ to see
it you have to scroll up... BTW, this does not happen if you close list 3
before opening 30, so that with the current version of your script you have
better close a list before opening another one.

Is there a way after opening the list 30 to scroll up to its beginning
automatically without having to do it manually? Alternatively, if this is
not possible, would it be possible to close the open list automatically
before opening a new one?

Thanks again,

Eustace
FromMe
ToEustace
SubjectRe: listCollapse.js (minor) bug
Date11 December 2009 22:59
Eustace,

> Is there a way after opening the list 30 to scroll up to its beginning
> automatically without having to do it manually?

The script cannot possibly know how far to scroll, since there could be any
number of other elements on the page obscuring it, and any number of
scrollable parent containers, any one of which can be affected when it
collapses the branches or when the user scrolls.

> Alternatively, if this is not possible, would it be possible to close the
> open list automatically before opening a new one?

You have configured the script to do this already. In fact, that's what is
causing the problem. The only reason it works when you do it manually is
that you do your scrolling *after* closing the menu.

The problem is that you have told the script to auto-collapse other
branches. This feature is only useful for lists without much content. In
your case, the monstrous list it too big for that feature to make sense. You
are better off not enabling auto-collapse (set the second parameter to false
when calling compactMenu). The menu will then behave predictably.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromEustace
ToMe
SubjectRe: listCollapse.js (minor) bug
Date13 December 2009 21:36
Hi Mark. Thanks for your prompt reply.

In both cases, set to auto-collapse or not set to auto-collapse, the script
behaves the same. The better solution is remember to collapse the open list
myself before opening another one.

I was hoping that there might have been a way to set some kind of bookmark
to the point where you are clicking to open a list, and have the focus
return there after collapsing the open list and opening the new one, but it
seems that this is not possible.

Having to collapse the open list before opening a new one is not that
difficult, it just takes a little time to learn to remember to do it.

Then, I have started breaking down the longer lists, which makes it easier
to find what you want, but I don't think it is practical to break them down
to the point where you don't have to remember to close the open list.

Sorry, I can't understand the last 4 paragraphs of the comment at the
beginning of the script, but I don't think they have to do with my case.

I have to spend some time on your site to see what else you have there that
I may find useful. Thanks again for your script.

Eustace
FromMe
ToEustace
SubjectRe: listCollapse.js (minor) bug
Date19 December 2009 09:28
Eustace,

> In both cases, set to auto-collapse or not set to auto-collapse, the
> script behaves the same.

I modified your page to use "false" instead of "true" for the second
parameter, and the problem went away. Are you sure you tested that properly?

> Sorry, I can't understand the last 4 paragraphs of the comment at the
> beginning of the script, but I don't think they have to do with my case.

They are discussed here:
http://www.howtocreate.co.uk/tutorials/jsexamples/listCollapseExample.html
And you are correct, they do not have anything to do with your case.


Tarquin
FromEustace
ToMe
SubjectRe: listCollapse.js (minor) bug
Date20 December 2009 01:35
Yes, you are right. The parameter "false" is better. Anyway, I've started to
break down the longer lists. Now only 2 lists are over 100 pages (143 and
108)... For this kind of thing your script is invaluable. Thanks again, 
Eustace
FromEustace
ToMe
SubjectRe: listCollapse.js (minor) bug
Date12 February 2010 10:48
Hi!

I am using your splendid listCollapse.js already with a webpage and I am
about to use it with another!

I have asked your advice for this webpage in the past - as you will see I
have subdivided the longer lists, though still some are too long:

[URL]

(The links do not work: the visitor is advised how to download in his
computer the necessary files.)

What I would like now is to have the Greek (expandable) titles (that with
your script take the color of links) in a different color than the actual
scan_XX links. Is there any way to do this?

I could, of course, assign a color style to each <a ...>, but that would be
too complicated because of their great number. I would like to assign the
color style (or better an id="...") to the Greek titles, that are fewer in
number.

Thanks,

Eustace
FromMe
ToEustace
SubjectRe: listCollapse.js (minor) bug
Date24 February 2010 10:21
Eustace,

Apologies for the late response.

> What I would like now is to have the Greek (expandable) titles (that with
> your script take the color of links) in a different color than the actual
> scan_XX links. Is there any way to do this?

The easiest way I can think of is to use CSS 2 selectors to match the href
of the links. My script creates all of its links with a href of "#" which
can be targeted like this:

a[href="#"] { color: lime; }

This will not work in IE 6 or earlier versions of IE, but will work from IE
7 onwards. It works perfectly in current releases of all other major
browsers, of course. I'd just ignore IE 6 completely.

You could also use CSS 3 selectors to match your links instead:
a[href^="scan"] { color: #ffff00; }

Amazingly, this little part of CSS 3 selectors also works in IE 7+, but be
careful; IE does not have complete support for CSS 3 selectors yet, so make
sure you test it properly in versions you want to support.


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