PDA

View Full Version : Change location of Floating Menu Script



bagman002
05-13-2012, 09:41 PM
1) Script Title: Floating Menu Script

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

3) Describe problem:

I am not really having a problem I have more a question.

I want to know how I can change the position. I currently have the floating menu coming frombottom but would like to move it up the page about 5cm.

I have tried changing the line that is in red but that only changes the position of the box in my editor not when live.

If anyone could help that would be great

My Current Code:

<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>

<layer id="divStayTopLeft" left="-5" top="2300">

<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<table border="1" width="140" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#000000">
<p align="center" class="style7"><font size="4">Menu</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#000000">
<p align="center" class="style5">*<span class="style10"><a href="#android">Android</a><br>
*<a href="#software">Software</a><br>
*<a href="#hardware">Hardware</a><br>
*<a href="#website">Websites</a><br>
<a href="#google">Google Products</a></span></td>
<tr> <td width="100%" bgcolor="#000000">
<p align="center" class="style7"><font size="4">Businesses</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#000000">
<p align="center" class="style5">*<span class="style10"><a href="#10">Telecommunications</a><br>
<a href="#000">Public Safety</a></span></td>



</tr>
<tr>
</tr>
</table>
<span class="style5">
<!--END OF EDIT-->
</span></layer>


<span class="style5">
<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()
{
var startX = 3,
startY = 150;
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>