PDA

View Full Version : Smart Menu Folding Tree



maksbud
01-21-2006, 08:52 PM
re:http://dynamicdrive.com/dynamicindex1/navigate1.htm

Hi I'm new here and I've been trying to use this script,
on multiintech (http://www.multiintech.com/examples/index.html) the menu works great.
I've made some changes to make it appear open when you first visit. the only thing is I want to change the background image to have an arrow point right when closed and down when open like this example, (http://www.multiintech.com/examples/Sample2.html) that script is ok and I figured out how to move the arrow where I want it ..but I didn't try to figure out how to make it show open on first visit,, besides I like the folding tree better ;)
Thanks to any help I can get.

Twey
01-21-2006, 09:02 PM
The problem is that you use a single image for the whole thing. Firstly, use a single blank image; write the text on over the top. That's what background images are for. If you just use two image elements - a blank menu background and an arrow - then add text on over the top, you save bandwidth and make your site more accessible. Secondly, use two different images for the menu background and the arrow.
Do this, then post back.

P.S. I hope Apple don't decide to sue over Aqua :p

maksbud
01-21-2006, 09:31 PM
Thanks for the quick reply.
I tried using text over the image but every time it would put the text next to or after the image. this script is looking for a open or closed folder image next to it. so I tried to just use changing back ground images,,no luck. this is the script so far,, I have 2 diff. images 1 for arrow right 1 for arrow down but I can't seem to pull them in?
ps. that is a screen shot from my desk, chooped up and put back together in pieces, I'm using a theme hack to make it look like OSX.

<!--
//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="menuhead1.jpg"
img2=new Image()
img2.src="menuhead2.jpg"

var ns6=(document.getElementById&&!document.all||window.opera)
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=="nahead")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="nahead"||cur.id=="foldinglist"){
iscontained=(cur.id=="nahead")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}

if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("DIV")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.divStyleImage="url(menuhead2.jpg)"
}
else{
foldercontent.style.display="none"
cur.style.divStyleImage="url(menuhead1.jpg)"
}
}
}

if (ie4||ns6)
document.onclick=checkcontained
///
function get_cookie(Name) {
//Get cookie routine by Shelley Powers
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
// if cookie exists
if (offset != -1) {
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

var foldercontentarray=new Array()
var c=0

if (ns6){
for (i=0;i<document.getElementsByTagName("UL").length;i++){
if (document.getElementsByTagName("UL")[i].id=="foldinglist"){
foldercontentarray[c]=document.getElementsByTagName("UL")[i]
c++
}
}
}

maksbud
01-24-2006, 05:32 AM
Weeee :cool: MultiInTech (http://multiintech.com/OnceMore/index.html)
I guess with enuf hackin you can get somethin done.
I just have to get a few more things active,,like the address bar, search, folder, maybe a style sheet changer from the view button,, now if I could just get it to show up in IE nicley i'll be doin good :)