Results 1 to 4 of 4

Thread: function dysfunction: missing a clue with javascript

  1. #1
    Join Date
    Aug 2008
    Location
    Las Vegas, NV
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default function dysfunction: missing a clue with javascript

    1) Script Title: Floating Menu Script

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

    3) Describe problem:
    I saw this menu on www.starbucks.com and I found a script that would give me a similar action for a site I am developing. On DD I found http://www.dynamicdrive.com/dynamici...icmenu_dev.htm and installed it, checking all the code and comparing it ot the source on DD and I cannot see a difference. I have it loaded on http://achtungmediadesign.com/th/index2.html ...anyone have some thoughts. I want to reposition this and have it floaty ... scott

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Here you go:
    http://www.quirksmode.org/css/position.html
    Read about the fixed position. Then take a look at how to fix it in IE:
    http://www.google.com/search?hl=en&c...ie&btnG=Search
    Jeremy | jfein.net

  3. #3
    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 outdated, use this version:

    Code:
    <script type="text/javascript">
    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">
          <b><font size="4">Menu</font></b></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 JSFX_FloatTopDiv()
    {
    function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
    }
    	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){el.style.left=x+PX;el.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>
    - John
    ________________________

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

  4. #4
    Join Date
    Aug 2008
    Location
    Las Vegas, NV
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default you so rock!

    Thank you John... I am going to play with it and change the position. I want to anchor it with a menu like on www.starbucks.com ... this is where I got the idea. THANK YOU!

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
  •