Smart folding menu (http://dynamicdrive.com/dynamicindex1/navigate1.htm)
I am trying to add some more icons to the different subfolders to make the menu more intuitive, but I guess there are things that need to be added to this part of the script:
//Smart Folding Menu tree- By Dynamic Drive (rewritten 03/03/02)
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
var head="display:''"
img1=new Image()
img1.src="fold.gif"
img2=new Image()
img2.src="open.gif"
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}
if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(open.gif)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(fold.gif)"
}
}
}
if (ie4||ns6)
document.onclick=checkcontained
//-->
</script>
Can someone give me a hand in this?
TIA,
Carolien
By more icons, do you mean different icons or just several icons on one line?
For my website I use TreeView (www.treeview.net), you can set different icons for different file types and the script is very flexible.
click here for an offical demo (http://www.treeview.net/treemenu/3fr_beenthere.html)
click here for a demonstration on my website (login=dynamicdrive) (http://www.afpsupport.r8.org/access/)
cr3ative
No, I meant different icons for different folders, even different icons for every seperate <li> if possible.
I first wanted to use a script that was similar to the one you describe, but since part of the tree is dynamicly built using php, I found it too hard to incorporate that in the js part, so I turned to the DD script.
Best,
Carolien
You could try disabling icons altogether and inserting different icons where you input the text using <img src='filename'>, but this script only has 2 icons; one for each level. edit: you can customize each icon using CSS as described below.
cr3ative
It's possible to apply a different folder image to a specific sublist item by using CSS. The main code to edit is the code of Step 3: