PDA

View Full Version : Javascript drop down menu compatibility issues



zeebo17
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!
Thanks!






var menu=function(){

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

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

dd.prototype.init=function(p,c){

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

for(i;i

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+')');

}

}

dd.prototype.st=function(x,f){

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

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

if(f){

p.className+=' '+a;

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

if(c.mh==c.offsetHeight){c.style.overflow='visible'}

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((h<=0&&f!=1)||(h>=c.mh&&f==1)){

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)+')';

c.style.height=h+(d*f)+'px'

}

return{dd:dd}

}();