Results 1 to 2 of 2

Thread: Floating Menu Script

  1. #1
    Join Date
    Aug 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Floating Menu Script

    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/dynamici...staticmenu.htm

    Here's the page I'm working on:
    http://www.o2designs.co.uk/atlantisn...n/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
    Last edited by jonkemm; 08-10-2006 at 03:11 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Use this version of the main script, keep the rest (the little script and your menu HTML) the same as what you have already:

    Code:
    <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>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •