Results 1 to 4 of 4

Thread: floating menu script failed

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

    Default floating menu script failed

    1) Script Title:floating menu script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...staticmenu.htm

    3) Describe problem: I installed the script at the bottom of the html page (right above the </body> tag as said). It displays my menu but it doesn't slide as it should. I have done no change in the script but: var verticalpos="fromtop" instead of "frombottom".
    I hope someone can help to fix that problem.

    Best regards,

  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

    That script is way out of date, this version works:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    <body>
    <img src="../side/1st.jpg">
    <script>
    if (!document.layers)
    document.write('<div id="divStayTopLeft" style="position:absolute">')
    </script>
    
    <layer id="divStayTopLeft">
    
    <!--EDIT BELOW CODE TO YOUR OWN MENU-->
    <table border="1" width="130" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" bgcolor="#FFFFCC" align="center">
          <span><b><font size="4">Menu</font></b></span></td>
      </tr>
      <tr>
        <td width="100%" bgcolor="#FFFFFF">
          <span>*<a href="http://www.dynamicdrive.com">Dynamic Drive</a><br>
          *<a href="http://www.dynamicdrive.com/new.htm">What's New</a><br>
          *<a href="http://www.dynamicdrive.com/hot.htm">What's Hot</a><br>
          *<a href="http://www.dynamicdrive.com/faqs.htm">FAQs</a><br>
          *<a href="http://www.dynamicdrive.com/morezone/">More Zone</a></span></td>
      </tr>
    </table>
    <!--END OF EDIT-->
    
    </layer>
    
    
    <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="frombottom"
    
    if (!document.layers)
    document.write('</div>')
    
    function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
    }
    
    function JSFX_FloatTopDiv()
    {
    	var startX = 3,
    	startY = 150;
    	var PX='px', 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,PX='';}
    		el.sP=function(x,y){this.style.left=x+PX;this.style.top=y+PX;};
    		el.x = startX;
    		if (verticalpos=="fromtop")
    		el.y = startY;
    		else{
    		el.y = window.innerHeight ? pageYOffset + window.innerHeight : ietruebody().scrollTop + ietruebody().clientHeight;
    		el.y -= startY;
    		}
    		return el;
    	}
    	window.stayTopLeft=function()
    	{
    		if (verticalpos=="fromtop"){
    		var pY = window.innerHeight ? pageYOffset : ietruebody().scrollTop;
    		ftlObj.y += (pY + startY - ftlObj.y)/8;
    		}
    		else{
    		var pY = window.innerHeight ? pageYOffset + window.innerHeight : ietruebody().scrollTop + ietruebody().clientHeight;
    		ftlObj.y += (pY - startY - ftlObj.y)/8;
    		}
    		ftlObj.sP(ftlObj.x, ftlObj.y);
    		setTimeout("stayTopLeft()", 10);
    	}
    	ftlObj = ml("divStayTopLeft");
    	stayTopLeft();
    }
    JSFX_FloatTopDiv();
    </script>
    </body>
    </html>
    - John
    ________________________

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

  3. #3
    Join Date
    Feb 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Floating Menu

    I was trying to contact Roy Whittle, but you seem to know this code.

    I was using the "older" code and it worked well until I tried to publish it using FrontPage. The htm file caused a "server timed out" error. I tracked the cause down to a missing "type=text/javascript" parameter in the first "<script>." Once fixed, it published and worked perfectly. I haven't tested the newer version yet.

    Is there a way to get this code to work from a js file? For example, I am building several newsletter pages all of which will use this code. Rather than paste it into each page, I would like to put the code in a floatmenu.js file then access it in the <head> using <script type=text/javascript src="http://.../floatmenu.js">.

    I've seen this done with another floating menu routine. But I really like how this one works--nice and smooth.

    Any thoughts?

  4. #4
    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

    Quote Originally Posted by cbe-guru View Post
    I was trying to contact Roy Whittle, but you seem to know this code.

    I was using the "older" code and it worked well until I tried to publish it using FrontPage. The htm file caused a "server timed out" error. I tracked the cause down to a missing "type=text/javascript" parameter in the first "<script>." Once fixed, it published and worked perfectly. I haven't tested the newer version yet.

    Is there a way to get this code to work from a js file? For example, I am building several newsletter pages all of which will use this code. Rather than paste it into each page, I would like to put the code in a floatmenu.js file then access it in the <head> using <script type=text/javascript src="http://.../floatmenu.js">.

    I've seen this done with another floating menu routine. But I really like how this one works--nice and smooth.

    Any thoughts?
    http://home.comcast.net/~jscheuer1/side/float_menu/
    - 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
  •