PDA

View Full Version : Floating Menu Script



jonkemm
08-10-2006, 02:41 PM
Hi Guys & Gals,

I have a problem with the Floating Menu Script, it doesn't start at the same height in Firefox & IE 6.

Here's the page I'm using on DD:
http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm

Here's the page I'm working on:
http://www.o2designs.co.uk/atlantisnightclub.co.uk/atlantis_information/pub2club.asp

It looks fine in Firefox, but is too low in IE6.

Am I being dumb?

I've tried to convert the script to enable me to use two different heights but failed miserably.

This is what I tried:

var navVer = navigator.appVersion;
if((navigator.appName=="Netscape") && (parseInt(navigator.appVersion)==4))
{
startY = 440;
}
else
{
startY = 478;
}

It seemed to be reasonable, but it stops the menu sliding...


Jk

jscheuer1
08-10-2006, 07:06 PM
Use this version of the main script, keep the rest (the little script and your menu HTML) the same as what you have already:


<script type="text/javascript">

/*
Floating Menu script- Roy Whittle (http://www.javascript-fx.com/)
Script featured on/available at http://www.dynamicdrive.com/
This notice must stay intact for use
*/

//Enter "frombottom" or "fromtop"
var verticalpos="fromtop"

if (!document.layers)
document.write('</div>')

function JSFX_FloatTopDiv()
{
var startX = document.body.filters? 10: 8,
startY = 93;
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function ml(id)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
if(d.layers)el.style=el;
el.sP=function(x,y){this.style.left=x;this.style.top=y;};
el.x = startX;
if (verticalpos=="fromtop")
el.y = startY;
else{
el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el.y -= startY;
}
return el;
}
window.stayTopLeft=function()
{
if (verticalpos=="fromtop"){
var pY = ns ? pageYOffset : document.body.scrollTop;
ftlObj.y += (pY + startY - ftlObj.y)/8;
}
else{
var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj.y += (pY - startY - ftlObj.y)/8;
}
ftlObj.sP(ftlObj.x, ftlObj.y);
setTimeout("stayTopLeft()", 10);
}
ftlObj = ml("divStayTopLeft");
stayTopLeft();
}
JSFX_FloatTopDiv();
</script>