473,387 Members | 1,536 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,387 software developers and data experts.

How do I fix this dynamic menu ?

290 100+
Hi I have a dynamic menu on my site and it uses
javascript to make slide up and down the page.

I think its pretty cool but it seems that it works independently of the
page so if you try and reduce the width of the window, it starts getting messed up.

Have a look here and you will see what I mean:

my website

One other thing I don't like is that it forces the window to 100% each
time you click a link, I am sure that will annoy people.

Is there an easy way to stop the central column from "crashing into" the menu when the window width is reduced ?

And how do I stop this 100% window without messing the page up ?

Thanks for any advice.

The menu code is here :

(there are a few lines of php but the main part is all javascript)



Expand|Select|Wrap|Line Numbers
  1.  
  2. /*
  3. * Next display the menu.
  4. *
  5. *
  6. */
  7. $start = 0;
  8. $last = 20;
  9.  
  10.         $sql = "SELECT sc_name, user_id FROM clients
  11.         WHERE confirm = 'y'  
  12.       AND type = 'E'
  13.       ORDER BY lig_pos DESC LIMIT $start,$last";             
  14.  
  15.         $result = mysql_query($sql)
  16.          or die ("Could not execute STARTER FEATURE query.");
  17.  
  18.         while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  19.             {
  20.             $Links[] = $row;
  21.             }
  22.  
  23.  
  24. //--> Output data.
  25.  
  26. echo '
  27. <div id="divStayTopLeft" style="position:absolute">
  28. <div class="menuH">Top Experts</div>
  29. <ul class="categorylinks">';
  30.  
  31. foreach ($Links as $Link){
  32. $the_link = str_replace(" ","%20",$Link['sc_name']);
  33. echo "<li><a href=\"/$the_link/internet_marketing/expert/guru_{$Link['user_id']}\">&nbsp;{$Link['sc_name']}</a></li>";
  34. }
  35. echo '</ul>';  
  36. ?>            
  37.  
  38. </div>
  39. <script type="text/javascript">
  40.  
  41.  
  42.  window.moveTo(0,0);
  43.  window.resizeTo(screen.width,screen.height);
  44.  
  45. /*
  46. Floating Menu script-  Roy Whittle (http://www.javascript-fx.com/)
  47. Script featured on/available at http://www.dynamicdrive.com/
  48. This notice must stay intact for use
  49. */
  50.  
  51. //Enter "frombottom" or "fromtop"
  52. var verticalpos="frombottom"
  53.  
  54. document.write('<\/div>')
  55.  
  56. function JSFX_FloatTopDiv()
  57. {
  58.     var startX = 20,
  59.     startY = 600;
  60.     var ns = (navigator.appName.indexOf("Netscape") != -1);
  61.     var d = document;
  62.     function ml(id)
  63.     {
  64.         var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
  65.         if(d.layers)el.style=el;
  66.         el.sP=function(x,y){this.style.left=x;this.style.top=y;};
  67.         el.x = startX;
  68.         if (verticalpos=="fromtop")
  69.         el.y = startY;
  70.         else{
  71.         el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  72.         el.y -= startY;
  73.         }
  74.         return el;
  75.     }
  76.     window.stayTopLeft=function()
  77.     {
  78.         if (verticalpos=="fromtop"){
  79.         var pY = ns ? pageYOffset : document.body.scrollTop;
  80.         ftlObj.y += (pY + startY - ftlObj.y)/8;
  81.         }
  82.         else{
  83.         var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
  84.         ftlObj.y += (pY - startY - ftlObj.y)/8;
  85.         }
  86.         ftlObj.sP(ftlObj.x, ftlObj.y);
  87.         setTimeout("stayTopLeft()", 10);
  88.     }
  89.     ftlObj = ml("divStayTopLeft");
  90.     stayTopLeft();
  91. }
  92. JSFX_FloatTopDiv();
  93. </script>
  94.  
  95.  
Feb 2 '09 #1
1 1199
acoder
16,027 Expert Mod 8TB
The 100% problem is caused by lines 42-43. Remove them.

As for the script, it's a bit of mix-mash of old code/browser detection. You can use position: fixed instead. It works in most modern browsers. It doesn't work in IE6 though, but you can use this fix.
Feb 3 '09 #2

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

Similar topics

1
by: Macamba | last post by:
Hi all, I am currently developing a website for a voluntary organisation. It is my first step in website development. The dynamic menu I developed has some bugs, which I addressed in another...
4
by: Stromboli | last post by:
hi people, My problem is that I need to build a dynamic menu (preferably that works in all the browsers) that appears when I mouseover a certain link. The problem is that I have to declare...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: biela | last post by:
Hi I'm from Poland and I have small question :). I'm looking for sample example how to create dynamic menu. Generaly my website will see like that ------------------------------------ 2...
2
by: vikram | last post by:
I have to design a page which contains a dynamic generated menu at left side.Menu will be generated once a user log in and will remain as it is for the rest of the user session. Problem is that...
19
by: mart2006 | last post by:
I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu....
3
by: RahimAsif | last post by:
I am writing an application that requires the a portion of the main menu to be dynamic. The menu has file, panels, view files and help across the top. The view files sub menu needs to be...
0
by: benfly08 | last post by:
Hi, I used SWT to develop an windows application. In the application there is a dynamic created popup menu. The dynamic part is that i will pass a list of name to be a submenu of one menu item....
10
by: mart2006 | last post by:
Hi, I'm fairly new to PHP and I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.