Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:34

Follow Scrolling and Relative Positioning


Poster: timothy
Dated: Tuesday April 6 2004 - 0:21:44 BST

I would like to use follow scrolling, but this doesn't seem to work if the menu uses relative positioning. Is there anything I can do to set this up? If not, how would I use absolute positioning so that my menu appears in the same place in both IE, NS, and Mozilla? I'd rather not use magic numbers and instead have this computed somehow.

My site:
http://members.rogers.com/haritunt/personal/

As a side question, my menu doesn't center properly in IE (works in Firefox though!). Any help on this would be great too!


Poster: Maz
Dated: Tuesday April 6 2004 - 0:35:12 BST

The menu won't work in a div.

To get what you want remove postion relative, use top=?; and left=?;
followscroll=1;

and take out the drawmenus from the div.

Regards,
maz


Poster: timothy
Dated: Tuesday April 6 2004 - 1:13:16 BST

Yikes, that's a bit more of a redesign than I wanted to do. I guess I'll just leave things as they are for the time being. Other than the inability to use follow scrolling, are there any other disadvantages to placing the menu in a div?

Thank you for the fast reply!


Poster: Maz
Dated: Tuesday April 6 2004 - 3:29:04 BST

You really need to remove it from the div, the submenus won't work properly. If you are using css styles without tables you really need to place the menu on top and position it absolute.

You can place it in a table, but I never advise it because it works so much better cross platform on top.

Its really easy, look:

with(milonic=new menuname("Main Menu")){
style=menuStyle;
top=14;
screenposition="center";
menualign="center";
followscroll=1;
alwaysvisible=1;
orientation="horizontal";
aI("text=Home;url=index.html;");
aI("text=About Me;showmenu=About Me;");
aI("text=Projects;showmenu=Projects;");
aI("text=Games;showmenu=Games;");
}


you might want to include
menuwidth="250px"; or more
menuheight="25px";
itemwidth="??"; if you want all the items the same length, or place item width in any menu item without quotes.

If you want to change the submenu colors just duplicate the styles and give it a new name instead of menuStyle

If you want to add any style to a menu item just leave off the quotes around the value.

Simple once you get it.

maz


Poster: Ruth
Dated: Tuesday April 6 2004 - 10:42:00 BST

I agree with Maz on removing it from the div. Besides, Maz gave you the code you need so not much work ;) and it would followscroll, and not have unknown issues come up because it's in a div. :)

Ruth


Poster: timothy
Dated: Wednesday April 7 2004 - 4:06:10 BST

Thank you for all your input in this matter. I have gone ahead and switched my menu to use absolute positioning. It was rather easy to get the layout correct once I made sure my stylesheet rendered both IE and FF identically.

A couple final questions, where should I place the script tag which contains the call to drawMenus()? Right now, it is located just before </body>.

Also, I am using a JavaScript which allows the user to turn follow scrolling on and off. I am using a *slightly* modified version of the code in a sample on the Milonic website. Here is the part which does the work:

Code:
  var menu = getMenuByName("Main Menu");
 
  if (!document.options || document.options.followscroll.checked) {
    _m[menu][5]  = null;
    _m[menu][2]  = 15;
    _m[menu][3]  = 45;
    //_m[menu][19] = 1;
    followScroll(menu,50,2);
    setFollowScrollCookieValue("true");
  }
  else {
    _m[menu][5]  = "top;left";
    _m[menu][2]  = "offset=15";
    _m[menu][3]  = "offset=45";
    //_m[menu][19] = 0;
    setFollowScrollCookieValue("false");
  }

  _setPosition(menu)


You will see two lines commented out. The menu seems to work fine with these removed. In fact, I'd almost say it works better when these lines are commented out. What purpose do they serve?

Thanks for all your help!


Poster: Maz
Dated: Wednesday April 7 2004 - 4:11:24 BST

A quick guess is the drawmenus should go at the end of the menu-data and the js stuff either your template or possibly at the top of the the menu_data just after the first top lines.

My post Random image may be similar.

maz


Poster: Ruth
Dated: Wednesday April 7 2004 - 5:20:41 BST

That is the reference number in the menu coding [I'm sure I'm not using the correct terms] to followscroll. I guess everything has a number reference inside the coding. 19 refers to followscroll, so maybe it works better commented out because you are setting a function of your own for it? As Schultz would say "I know nothing!" :roll:

Ruth


Poster: Maz
Dated: Wednesday April 7 2004 - 7:51:52 BST

I think drawmenus has to go back into menu_data.js at the bottom because you aren't using a table.

Then something like followscroll script is true goes on the html page after menu_data script. And a reference to activate the main menu on menu_data.

But I'm not sure how followscroll is actived.

maz