PDA

View Full Version : need an option to "expand all" in folding tree menu



ender
09-28-2004, 05:25 PM
Script: smart folding menu tree (http://www.dynamicdrive.com/dynamicindex1/navigate1.htm)

Hi! I'm working with this script above and the default is for the menu to be collapsed until clicked, the tree can persist and still be open when you come back to the page.

I need to provide the user with one button that will expand all the lists as a way of browsing the categories without clicking 50 times. I haven't touched javascript in a couple of years and would really appreciate any help on this, i'm stumped.

Thanks in advance!

rogerpilkey
12-15-2004, 08:41 PM
Probably too late for the original poster, but for anybody reading this in the future, try this:

function openallfolders(){
if (ns6){
for (i=0; i<=foldercontentarray.length; i++){
foldercontentarray[i].style.display=''
foldercontentarray[i].previousSibling.previousSibling.style.listStyleImage="url(open.gif)"
}
}
else {
for (i=0; i<foldinglist.length; i++){
foldinglist[i].style.display=''
document.all[foldinglist[i].sourceIndex -1].style.listStyleImage="url(open.gif)"
}
}
}


and the link should look like this:

<a href="javascript:openallfolders()"> open all folders </a>


and the "close all":

function closeallfolders(){
if (ns6){
for (i=0; i<=foldercontentarray.length; i++){
foldercontentarray[i].style.display='none'
foldercontentarray[i].previousSibling.previousSibling.style.listStyleImage="url(fold.gif)"
}
}
else {
for (i=0; i<foldinglist.length; i++){
foldinglist[i].style.display='none'
document.all[foldinglist[i].sourceIndex -1].style.listStyleImage="url(fold.gif)"
}
}
}

with the link:

<a href="javascript:closeallfolders()"> close all folders </a>


Rog

mrsteve777
02-07-2005, 06:22 PM
Thank You, works beautifully.

Willem
02-09-2006, 03:25 PM
Hi all,

nice your reply @ dynamic drive about closeallfolders()

Trying to change the script I did not find a good solution.

At http://gammaholding.willemdezeeuw.nl you find the menu filled by a simple mdb. It's with dutch & english now.

As you can see there, I hav 5 maingroups. I tryed to close the groups and only the active groep was unfolded. Other main group? Close the old open the new. With every thing opened there is not enough space.

Do you have a clue?

Thanks a lot,
Willem de Zeeuw

PS I'm new in this forum