473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

I need help customizing a Floating Menu to go through a table only

1
I am working in a floting menu for a website, I found this cool script, it works great, but I need to limit the movement of the menu to a table area, right now it goes up and down through the whole body, is there a quick fix for this? please help.

Thanks.



Expand|Select|Wrap|Line Numbers
  1. <script>
  2. if (!document.layers)
  3. document.write('<div id="divStayTopLeft" style="position:absolute">')
  4. </script>
  5.  
  6. </p><layer id="divStayTopLeft">
  7.  
  8. <!--EDIT BELOW CODE TO YOUR OWN MENU-->
  9. <table border="1" width="110" cellspacing="0" cellpadding="0">
  10.   <tr>
  11.     <td width="100%" bgcolor="#CCCCCC"> 
  12.       <p align="center"><b><font size="4" face="Arial Narrow, Arial">Quick Links</font></b></td>
  13.   </tr>
  14.   <tr>
  15.     <td width="100%" bgcolor="#FFFFFF"> <p align="left"> <img src="images/s" width="5" height="1"><a href="http://www.dynamicdrive.com"><font size="3" face="Arial Narrow, Arial">Contact 
  16.         Us</font></a><font size="3" face="Arial Narrow, Arial"><br>
  17.         <img src="images/s" width="5" height="1"><a href="http://www.dynamicdrive.com/new.htm">How To Pay</a><br>
  18.         <img src="images/s" width="5" height="1"><a href="http://www.dynamicdrive.com/hot.htm">About Us</a><br>
  19.         <img src="images/s" width="5" height="1"><a href="http://www.dynamicdrive.com/faqs.htm">FAQs</a><br>
  20.         <img src="images/s" width="5" height="1"><a href="http://www.dynamicdrive.com/morezone/">About Shipping</a></font></td>
  21.   </tr>
  22. </table>
  23. <!--END OF EDIT-->
  24.  
  25. </layer>
  26.  
  27.  
  28. <script type="text/javascript">
  29.  
  30. /*
  31. Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
  32. Script featured on/available at http://www.dynamicdrive.com/
  33. This notice must stay intact for use
  34. */
  35.  
  36. //Enter "frombottom" or "fromtop"
  37. var verticalpos="frombottom"
  38.  
  39. if (!document.layers)
  40. document.write('</div>')
  41.  
  42. function JSFX_FloatTopDiv()
  43. {
  44.     var startX = 3,
  45.     startY = 150;
  46.     var ns = (navigator.appName.indexOf("Netscape") != -1);
  47.     var d = document;
  48.     function ml(id)
  49.     {
  50.         var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
  51.         if(d.layers)el.style=el;
  52.         el.sP=function(x,y){this.style.left=x;this.style.top=y;};
  53.         el.x = startX;
  54.         if (verticalpos=="fromtop")
  55.         el.y = startY;
  56.         else{
  57.         el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  58.         el.y -= startY;
  59.         }
  60.         return el;
  61.     }
  62.     window.stayTopLeft=function()
  63.     {
  64.         if (verticalpos=="fromtop"){
  65.         var pY = ns ? pageYOffset : document.body.scrollTop;
  66.         ftlObj.y += (pY + startY - ftlObj.y)/8;
  67.         }
  68.         else{
  69.         var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  70.         ftlObj.y += (pY - startY - ftlObj.y)/8;
  71.         }
  72.         ftlObj.sP(ftlObj.x, ftlObj.y);
  73.         setTimeout("stayTopLeft()", 10);
  74.     }
  75.     ftlObj = ml("divStayTopLeft");
  76.     stayTopLeft();
  77. }
  78. JSFX_FloatTopDiv();
  79. </script>
Jan 19 '08 #1
2 2135
JosAH
11,448 Expert 8TB
That is Javascript you're showing us in a Java forum. Those two languages have
nothing much in common despite their name. I'll move your question over to the
Javascript forum.

kind regards,

Jos (mod)
Jan 19 '08 #2
acoder
16,027 Expert Mod 8TB
I am working in a floting menu for a website, I found this cool script, it works great, but I need to limit the movement of the menu to a table area, right now it goes up and down through the whole body, is there a quick fix for this? please help.
Get the dimensions of the table (the top/left and width/height properties). From these, you can determine the 'bounding box' and where the menu should stay.
Jan 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: JHR | last post by:
Hey all, I'm trying to make a sidebar box float to the right of various items, and for those items to wrap if a user shrinks his browser window. Instead, in every browser I've tried except for...
4
by: Christina Joch | last post by:
Here´s the script for my floating menu. Is it possible to assign it to a table cell and if yes how to do it? I hope you mean what I want to do? Thanks for help, lg Christina <!-- Start if...
10
by: Bob | last post by:
Apparently customizing the system menu in a Form requires API calls... that's fine, but RemoveMenu doesn't work. Will I have to pop up my own menu to get rid of certain selections? Bob
5
by: jemcgui | last post by:
I've been building a site that has a quirk in it. It will display just as intended in IE but not firefox. The left "nav" div which is floating left will be forced down to the bottom of the page. The...
3
by: bdbeames | last post by:
I have a menu on the right side of my page and a flash object in the center. When a certain option in the menu is select a sub menu pops and floats left. The problem is, depending on the browser...
1
Parul Bagadia
by: Parul Bagadia | last post by:
I just wrote a code for myself to clear certain things........... When i made this program to execute in turbo c++ it didnt..... it showed following error. I have pasted the output after code is...
5
by: alck1234 | last post by:
Hi, I need help on my mini project on object orientated programming. The question goes like this: A mini-mart has just installed a bar code reader to improve efficiency at their checkouts....
4
by: Jason Carlton | last post by:
I'm working with the cookie-cutter code located here: http://www.jtricks.com/javascript/navigation/floating.html Very helpful script, BTW! I'm trying to modify it, though, so that the menu...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.