473,231 Members | 1,790 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,231 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 1197
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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.