PDA

View Full Version : Problem with Simple Tree and images



Brausepaul
01-15-2007, 02:18 PM
1) Script Title:
Simple Tree Menu

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

3) Describe problem:

I have problems with the images to show up consistently. I have to develop for Internet Explorer 6, so I can't say anything about other browsers. The problem is that if I don't set up the script to expand all folders per default the image for expanding won't show until the folder has been expanded once; it works fine afterwards. Any idea what could cause this?

From my JSP page:

...
<head>
<script src="<%=request.getContextPath() %>/js/simpletreemenu.js" type="text/javascript"></script>
...
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/simpletree.css" />
</head>
...
<script type="text/javascript">
ddtreemenu.createTree("treemenu", true)
</script>
...

My simpletree.css


.treeview ul{ /*CSS for Simple Tree Menu*/
margin: 0;
padding: 0;
}

.treeview li{ /*Style for LI elements in general (excludes an LI that contains sub lists)*/
background: url(./images/list.gif) no-repeat left center;
list-style-type: none;
padding-left: 22px;
margin-bottom: 3px;
}

.treeview li.submenu{ /* Style for LI that contains sub lists (other ULs). */
background: url(./images/plus.gif) no-repeat left 1px;
cursor: hand !important;
cursor: pointer !important;
}


.treeview li.submenu ul{ /*Style for ULs that are children of LIs (submenu) */
display: none; /*Hide them by default. Don't delete. */
}

.treeview .submenu ul li{ /*Style for LIs of ULs that are children of LIs (submenu) */
cursor: default;
}

My simpletreemenu.js

...
var persisteduls=new Object()
var ddtreemenu=new Object()

ddtreemenu.closefolder="./images/plus.gif" //set image path to "plus" folder image
ddtreemenu.openfolder="./images/minus.gif" //set image path to "minus" folder image

//////////No need to edit beyond here///////////////////////////
...


As you can see I use different images, they are in a folder next to the js folder where the script is located.