PDA

View Full Version : 2 x Floating Menu Script



Immi
03-12-2008, 09:40 PM
1) CODE TITLE: 2 x Floating Menu Script

2) AUTHOR NAME/NOTES: Immi

3) DESCRIPTION: For anyone who wants to have the menu twice (left/right for example)

4) URL TO CODE:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>menu-float</title>
</head>
<body>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<script>
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
</script>
<layer id="divStayTopLeft"><!--EDIT BELOW CODE TO YOUR OWN MENU--></layer>
<table border="1" cellpadding="0" cellspacing="0" width="130">
<tbody>
<tr>
<td bgcolor="#ffffcc" width="100%">
<p align="center"><b><font size="4">Menu</font></b></p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" width="100%">
<p align="left"> <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></p>
</td>
</tr>
</tbody>
</table>
<!--END OF EDIT-->
<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 = 0,
startY = 0;
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>
<script>
if (!document.layers)
document.write('<div id="divStayTopRight" style="position:absolute">')
</script><layer id="divStayTopRight"><!--EDIT BELOW CODE TO YOUR OWN MENU--></layer>
<table border="1" cellpadding="0" cellspacing="0" width="130">
<tbody>
<tr>
<td bgcolor="#ffffcc" width="100%">
<p align="center"><b><font size="4">Menu</font></b></p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" width="100%">
<p align="left"> <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></p>
</td>
</tr>
</tbody>
</table>
<!--END OF EDIT-->
<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 "frombottom2" or "fromtop2"
var verticalpos2="fromtop2"
if (!document.layers)
document.write('</div>')
function JSFX_FloatTopDiv2()
{
var startX2 = 0,
startY2 = 0;
var ns2 = (navigator.appName.indexOf("Netscape") != -1);
var d2 = document;
function ml2(id2)
{
var el2=d2.getElementById?d2.getElementById(id2):d2.all?d2.all[id2]:d2.layers[id2];
if(d2.layers)el2.style=el2;
el2.sP=function(x,y){this.style.right=x;this.style.top=y;};
el2.x = startX2;
if (verticalpos2=="fromtop2")
el2.y = startY2;
else{
el2.y = ns2 ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
el2.y -= startY2;
}
return el2;
}
window.stayTopRight=function()
{
if (verticalpos2=="fromtop2"){
var pY2 = ns2 ? pageYOffset : document.body.scrollTop;
ftlObj2.y += (pY2 + startY2 - ftlObj2.y)/8;
}
else{
var pY2 = ns2 ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
ftlObj2.y += (pY2 - startY2 - ftlObj2.y)/8;
}
ftlObj2.sP(ftlObj2.x, ftlObj2.y);
setTimeout("stayTopRight()", 10);
}
ftlObj2 = ml2("divStayTopRight");
stayTopRight();
}
JSFX_FloatTopDiv2();
</script>
</body>
</html>


Have fun with it.
Immi

Immi
03-16-2008, 09:50 PM
If someone needs an example please go to: http://www.pleitegeier96.de
Immi