Results 1 to 1 of 1

Thread: make the floating menu stay in same position although screen resolution is changed

  1. #1
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default make the floating menu stay in same position although screen resolution is changed

    I have a floating menu that on the right of my page. I want to make the floating menu just exactly beside from my table. But, it position is change and interlace my table when my screen resolution is changing.
    How to make the floating menu stay in same position although screen resolution is change?
    Code:
    <script>
    if (!document.layers)
    document.write('<div id="divStayTopRight" style="position:absolute">')
    </script>
    
    <layer id="divStayTopRight">
    
    <!--EDIT BELOW CODE TO YOUR OWN MENU-->
    
    <table border="1" width="20px" cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%" bgcolor="#800000" align="center">
        <a href="#">
         REGISTER
          </a> 
      </tr>
    </table>
    
    <!--END OF EDIT-->
    
    </layer>
    
    
    <script type="text/javascript">
    
    //Enter "frombottom" or "fromtop"
    var verticalpos="frombottom"
    
    if (!document.layers)
    document.write('</div>')
    
    function JSFX_FloatTopDiv()
    {
    	var startX = 0,
    	startY = 420;
    	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.right=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.stayTopRight=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("stayTopRight()", 10);
    	}
    	ftlObj = ml("divStayTopRight");
    	stayTopRight();
    }
    JSFX_FloatTopDiv();
    </script>
    Last edited by djr33; 04-11-2010 at 01:06 AM. Reason: When posting code, wrap it in [code] tags.

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
  •