PDA

View Full Version : dropTabs



complexity
12-23-2007, 03:52 PM
1) Script Title:
Drop down Tabs
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex1/droptabmenu.htm
3) Describe problem:

http://pastebin.ca/829892

It seems if i have the drop down be for the first link it works.. But if i start it at the second one it does not.

It must be because of the rel... Each one gets an auto rel even if it has no drop downs , Seems like the best way to do it cms wise..


The chrome drop down did not seem to mind this.

jscheuer1
12-23-2007, 08:08 PM
You will need to post a link to the actual page, as the code in your link has a rel for each item, so shouldn't be a problem as long as those are configured properly, which I cannot tell from the code you supply:

Please post a link to the web page on your site that demonstrates the problem so we can check it out.

But the bottom line is, don't give one of these a rel attribute if you don't intend to use it as a part of the script.

complexity
12-23-2007, 10:24 PM
<li><a href="#" rel="dropmenu58" title="Technology"><span>Technology</span></a></li>

As you can see in my paste bin that is the second top level link..

Only the second top level link has the drop down...

Not the first link...

And that makes it so the drop down does not work.

But if i take the rel out of the first link The second link drop down works , but it is not really easy to do in my case.

ddadmin
12-24-2007, 07:49 AM
Hmm do you have an actual example of the script running on that page? All I see is snippets of code posted, but not the actual script itself running.

complexity
12-24-2007, 01:24 PM
http://weknowfirst.com/demo/index.html

Notice that i have taken the rel out of the first top level link.. Which makes the second top level link drop down work..

But if i add a rel to it, the second drop down stops working , unless i have a drop down for the first one

With Chrome Drop down menu , you could have rels on anyone and it would not effect it.

jscheuer1
12-24-2007, 03:15 PM
Don't add the rel to it then, unless you intend to use it with the script. Any rel that doesn't have a menu associated with it wil break rels after it that do. You could try editing the script (addition red):


init:function(menuid, dselected){
this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
var menuitems=document.getElementById(menuid).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")&&document.getElementById(menuitems[i].getAttribute("rel"))){
var relvalue=menuitems[i].getAttribute("rel")
document.getElementById(relvalue).firstlink=document.getElementById(relvalue).getElementsByTagName("a")[0]
menuitems[i].onmouseover=function(e){
var event=typeof e!="undefined"? e : window.event
tabdropdown.dropit(this, event, this.getAttribute("rel"))
}
}
if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[i].href)){
menuitems[i].parentNode.className+=" selected default"
var setalready=true
}
else if (parseInt(dselected)==i)
menuitems[i].parentNode.className+=" selected default"
}
}

I hope this is obvious, but even this will still have problems if there is an element on the page with an id that matches the rel, but that is not intended to be a drop down menu.

complexity
12-24-2007, 03:18 PM
OK I guess its back to the chrome menu then....

I would need the rel on every one, This menu is generated so everyone must have a rel.

Thanks anyways.

jscheuer1
12-24-2007, 03:28 PM
I edited my last post, you might now find it more useful.

complexity
12-26-2007, 10:40 PM
That seemed to do the trick.. I have not found any drawbacks yet!