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:18

Relative positioning?


Poster: jumborex
Dated: Wednesday July 21 2004 - 19:08:10 BST

Sorry guys, but while evaluating the product I got stuck with a positioning problem. :cry:

This is the trial page:
http://www.cantodellasfinge.net/versi/menu.html

Menu is set inside a layer, and this is what I need for the site.
I cannot understand why the submenus appear very far from the place where I axpect them.
Code:
_subOffsetTop=10
_subOffsetLeft=-10

....

with(milonic=new menuname("Giochi in Versi")){
style=menuStyle;
position="relative";
alwaysvisible=1;
....   

Sorry if the question is stupid, but I cannot find a secure explanation inside your site. :oops:


Poster: Ruth
Dated: Wednesday July 21 2004 - 21:57:02 BST

Because the menu doesn't like being in a div, it's made up of divs. Why not set the position using top=113; left=228; and remove the position="relative".

Ruth


Poster: jumborex
Dated: Thursday July 22 2004 - 0:12:44 BST

Ruth wrote:
[...] Why not set the position using top=113; left=228; and remove the position="relative".

Ruth

Ok: it is working this way. But of course having all pages in the site made up of a stable part, plus a layer changing every time, the layer solution was more confortable.

I will evaluate, but if sombody has a new solution please post it! :roll:


Poster: Ruth
Dated: Thursday July 22 2004 - 0:31:28 BST

I'm sorry, someone else would have to help you with that. If you want to somehow attach the menu to the div maybe some javascript function could do that, but I see the div and it has a top and left position and is positioned absolutely so [unless absolute doesn't mean what it means in the outside world???] it would seem that if you set the menu to that position it will always appear at that point.

Ruth


Poster: kevin3442
Dated: Thursday July 22 2004 - 0:41:07 BST

The odd positioning will not happen in all browsers... it depends on how the browser calculates the positions of various containers. As Ruth mentioned, putting the menus inside of a div will have different effects in different browsers and is generally not recommended. If you want to do that... and I'm not sure if this'll work... you could try splitting the main menu code (your "Giochi in Versi" menu) away from the rest and load only that into the div. In otyher words, remove the "Giochi in Versi" menu code from the versi_data.js file and put it in another file... say, "versi_main.js". Load only versi_main.js into the div, and load the versi_data.js file in the head, after the ns4 conditional. Might be worth a shot.

Cheers,

Kevin


Poster: jumborex
Dated: Thursday July 22 2004 - 11:08:55 BST

Thanks! But unfortunately I'm not so proficient in JavaScript. :oops: I fear not being able to try at once this suggestion.

Now I purchased a license, and I will publish the first pages using the absolute positioning.

This page is working with all files in a separate menu, so I'm ready for the real work! ;)

http://www.cantodellasfinge.net/versi/menu2.html

Still confused about relative postioning


Poster: davebarnes
Dated: Monday August 9 2004 - 22:22:14 BST

I am still confused about how to make relative positioning work.

I have my menu at http://www.atcanewsletter.com/javascrip ... nu_data.js

For me, the code if interest is:
Code:
with(milonic=new menuname("News")){
style=Sub1MenuStyle;
top=224;
left=120;
aI("text=ATCA Vendors;url=/English/Resources/ATCA_Vendors.html;");
aI("text=ATCA in the News;url=/English/News/Ink.html;");
}

with(milonic=new menuname("AboutUs")){
style=Sub1MenuStyle;
top=304;
left=70;
aI("text=Contact Us;url=/English/Miscellaneous/Contact_Us.html;");
aI("text=Search;url=/English/Miscellaneous/Search.html;");
aI("text=Privacy Policy;url=/English/Miscellaneous/Privacy_Policy.html;");
aI("text=Copyright Notice;url=/English/Miscellaneous/Copyright.html;");
}


What I want is to make the absolute values of 224 and 304 both equal to "relative 10". That is, I want each submenu placed 10 pixels down from the top of the main menu image.

Question: How do I do this?

thanks,
dave


Poster: John
Dated: Monday August 9 2004 - 22:56:08 BST

Hey Dave -

If I understand what you're wanting to do (have the sub-menus basically at the top of the page when the main menu is 1/3 of the way down the page) - I disagree with the concept. Please tell me if I got it wrong!

If that is what you want, just take the height of the graphic (80) + the 10 you want and make that your top (top=90;). This isn't really relative positioning.

You'll really have to crank up the _menuCloseDelay value so folks can get to the subs before they close.


Poster: davebarnes
Dated: Tuesday August 10 2004 - 3:01:13 BST

John,

No.

I want my submenus to be 10 px down (below) their respective main menu image.

I want the menu to look as it looks now (Surf to http://www.atcanewsletter.com) except that I want to use releative postioning instead of absolute.

I want to avoid having to change the submenu postioning values whenever I add/subtract a main menu item.

,dave


Poster: John
Dated: Tuesday August 10 2004 - 15:12:47 BST

Let's see if I can do any better today, Dave...

These two items...
Code:
_subOffsetTop=10              // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset

...control the position of the sub-menus "relative" to the main menu items. Fiddle with these values and see if you get what you want. They can be + or -, as you see.

If that's not it, I'm goin' back home... :?


Poster: davebarnes
Dated: Wednesday August 11 2004 - 3:01:25 BST

So, now I think I understand.

Code:
_subOffsetTop=10              // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset

are default positions (as it were).

I added
Code:
left=nnn;

where nnn = the offset in pixels for THIS submenu
to each submenu
and life is good.