View Full Version : Javascript drop down menu compatibility issues

04-05-2010, 12:59 PM
Hi, I have found the following script for a drop down menu and I was wondering if there was a way to fix any of the following issues:

1) When you select an item on the menu, go to the new page, and then when you go back to the original page the menu item is still "open" and don't disappear until you hover over them. (So far I've only noticed this on firefox)

2) In IE7 (okay in IE8 and Firefox) when you move your mouse to the second level of the drop menu that expands to the right, it will disappear and instead jump to the drop down items of the next tab to the right.

3) In IE sometimes the menu items will drop down in two parts. The left hand side of the boxes/text and then the right hand side will follow.

Any help would be greatly appreciated!

var menu=function(){

var t=15,z=50,s=6,a;

function dd(n){this.n=n; this.h=[]; this.c=[]}


a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;


var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];

h.onmouseover=new Function(this.n+'.st('+i+',true)');

h.onmouseout=new Function(this.n+'.st('+i+')');




var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];

clearInterval(c.t); c.style.overflow='hidden';


p.className+=' '+a;

if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}


else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}

}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}


function sl(c,f){

var h=c.offsetHeight;


if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}

clearInterval(c.t); return


var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;

c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';