Ron Lipke

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromRon Lipke
ToMe
Subjectnested list collapsing script style change
Date25 March 2006 20:41
Hello.  Thanks for making this script available!  I am working on a family
tree site for a friend and this is exactly what I had been trying to come up
with.   So far everything is functioning perfect, so this is more of a style
question.

The material I am working with is derived from his family's historical
committee.  There is a strict number/letter sequence to the generations of
the family and I want that to be the navigation scheme to the collapsable
lists.  Is there anyway to get rid of the +/- item at the beginning of every
expandable item so that the first character of every line is the bullet or
sequence in the list?  I am indicating that there is expandable content
through styles and do not need the '+/-' item.

example:
I. First guy
A. His kids
1. Their kids
a. Their kids
II. Second Guy

I am just beginning with Javascript so I do not know if this is tied into
the code itself or just a stylistic decision you made.  Any help would be
appreciated.

Ron Lipke
FromMe
ToRon Lipke
SubjectRe: nested list collapsing script style change
Date26 March 2006 07:51
Ron,

> Is there anyway to get rid of the +/- item at the beginning of every
> expandable item so that the first character of every line is the bullet
> or sequence in the list?

assuming you are _not_ using CSS to set the ordered list style type, you
should be able to set the extra HTML to a blank string, and use this:

<li>1. <a>name of person</a>

The script will use everything upto the <a> element. Note that you may need
to restyle it to stop getting double lines, since there will now be two <a>
elements in each LI.

If you are using CSS to set the list style type ('a', 'A', 'iii', '3', etc),
then what you want to do is not possible.


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromRon Lipke
ToMe
SubjectRe: nested list collapsing script style change
Date26 March 2006 22:05
hmm..that didn't seem to work.  I am not using any css.  I haven't gotten
that far, just coding in the lists and then onto the style of the site.

By placing the content in <a> tags, the only change is the removal of the
link line, so the only clickable item is the List sequence number (I am
using unordered lists and numbering them manually).

Ron
FromMe
ToRon Lipke
SubjectRe: nested list collapsing script style change
Date27 March 2006 09:07
Ron,

> By placing the content in <a> tags, the only change is the removal of the
> link line, so the only clickable item is the List sequence number (I am
> using unordered lists and numbering them manually).

Ok, then I think I may have missed your point.

Basically, the blank string removes the +/- sign. The <a> can be used _if_
you want to, to make the script not use the enclosed text as its expand link
(it will only use whatever appears before it).

If you want to make the person's name _and_ the number into the expand link,
just use the blank string when calling the collapsing function.

If you want to make the number but not the name into the expand link, then
do what I said in the last mail.

If you want to make the name but not the number into the expand link, then
use the blank string when calling the collapse function, and use CSS to set
the numbers.
FromRon Lipke
ToMe
SubjectRe: nested list collapsing script style change
Date27 March 2006 19:52
Sorry for the confusion.  I don't think I am understanding the correctly. 
What do you mean by "a blank string".  No matter how I code each list item,
if it has a nested list, it shows up with the +/- character at the beginning
of the line.  I will upload the page I am working on so you can see it and
email you back if you can't think of anything.

Thanks
Ron
FromMe
ToRon Lipke
SubjectRe: nested list collapsing script style change
Date27 March 2006 20:15
Ron,

> What do you mean by "a blank string".  No matter how I code each list
> item, if it has a nested list, it shows up with the +/- character at the
> beginning of the line.

When you tell the script to collapse the list, you will probably be using
something like this:
compactMenu('someID',false,'&plusmn; ');
change that to:
compactMenu('someID',false,'');

&plusmn; is the HTML entity that creates the +/- character.
FromRon Lipke
ToMe
SubjectRe: nested list collapsing script style change
Date27 March 2006 20:25
Ah!  Thank you so much.  You have a lot of patience for us beginners =)

Another question if you don't mind.  Is there a way to use one command to
expand and collapse the entire list.  Say, after someone is done expanding a
few branches and they want to return its original fully collpase or fully
expanded state?

Ron
FromMe
ToRon Lipke
SubjectRe: nested list collapsing script style change
Date1 April 2006 13:02
Ron,

> Another question if you don't mind.  Is there a way to use one command to
> expand and collapse the entire list.

Not yet, but it is fairly easy to write;

function makeAllLists(oList,oShow) {
  if( !document.getElementById ) { return; }
  var oLsts = document.getElementById(oList);
  oLsts = oLsts.getElementsByTagName(oLsts.tagName);
  for( var i = 0; i < oLsts.length; i++ ) {
    oLsts[i].style.display = oShow ? 'block' : 'none';
  }
}

Then call it like this to collapse:
makeAllLists('someID',false);
And like this to expand:
makeAllLists('someID',true);

Note that this cannot be combined with the shouldAutoCollapse feature.
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.