PDA

View Full Version : floating menu script failed



jeeremie
09-18-2006, 08:58 AM
1) Script Title:floating menu script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/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,

jscheuer1
09-18-2006, 09:35 AM
That script is way out of date, this version works:


<!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>

cbe-guru
02-23-2007, 07:55 PM
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?

jscheuer1
02-24-2007, 06:29 AM
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/