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: Thursday February 8 2018 - 06:02:10

Menu Align Center Help Please

Poster: sketches
Dated: Monday April 12 2004 - 2:13:16 BST

I have used the command:


This works 'sometimes' in NS 7 and IE 6+ & Mozilla but sometimes the menu does not align correctly to the center until I do something like, minimise and maximise the window or operate any link in the menu (it skews off to the right by about 40 pixels)

I have no offsets in my script and have tried the 'align' command, 'menualign' and even wrapped by HTML <SCRIPT> Calls with a <CENTRE> Tag.

Has anyone seen this and what is the fix?


Poster: John
Dated: Monday April 12 2004 - 4:40:02 BST

URLs, as requested, really help us to help you a lot better.


Poster: sketches
Dated: Monday April 12 2004 - 10:27:04 BST

Thanks John - I have sent the URL to you by separate email as I have licensed it from Milonic to run on an adult site.

Unlike a lot of adult websmasters, I try to limit my website to an adult audience only so I don't publish it.

Poster: John
Dated: Monday April 12 2004 - 14:44:57 BST

Understood, sketches, and your thoughtfulness is most appreciated.

Unfortunately, I haven't seen your message, and I'm sure it got caught by the spam traps here at the university.

Next thought would be to post your code here (use the [code][/code] tags). Just the _data file and your JS menu calls, with a little of the surrounding HTML should get us going.



Poster: sketches
Dated: Monday April 12 2004 - 21:07:54 BST

Sorry, I did not know where to start so here is a URL (I'll edit and delete this post once you have noted it)


milonic is loaded into the same directory

As a sanity test I removed the menu script fron outside of my PHP software scritpt and just put it into the HTM page above - same problem

(I was building it into http://deleted_too_adult/personals/main.php )

Here is the bit in the code:

Code: Select all

with(milonic=new menuname("Main Menu")){

Thanks for your thoughts


Poster: Ruth
Dated: Monday April 12 2004 - 21:10:03 BST

Also, in case it is something to do with a css style, check all the margin, padding etc, settings in any css file you have. Usually, I try just eliminating any style sheet first, if that's possible, next bet is to start removing items that relate to margins and padding one at a time.



Poster: sketches
Dated: Monday April 12 2004 - 21:18:37 BST

Thanks Ruth

As you can see from the URL above (test.htm) I have stripped it back to the bare bones with no css sheet - still same problem that it does not center on first load and I have to minimise/maximise window to do it.

I have Win 2000 Professional running from a laptop running an ATI Radion 7500 video card (not sure how this java magic works but I guess the video hardware might come into it)

I asked a friend to check it on Win 98 using an MX Pro Video Card and same problem.

One useful observation

Poster: sketches
Dated: Monday April 12 2004 - 21:27:13 BST

This may help milonic team as I have a slow modem and can see this thing unfold in lovely slow motion :)

on test.htm (URL above) The dark purple menu background (border) I have selected centers perfectly, but it does not take account of the total size of the images I am loading (the background appears smaller than the final loaded pixel width total of the images).

So when each images loads from left to right, the menu extends out to the right to fit all of the images in.

It only re-centers after I minimise/maximise the page or do a menu action (as the images are now in my cache)


Is there a command that allows me to set the pixel width of the border?

PS The test page is optimised for 1024 x 768 but will just squeeze into an 800 x 600 screen

Poster: kevin3442
Dated: Tuesday April 13 2004 - 18:43:42 BST

It sounds like you've identified the problem. The menu is rendered before the browser is finished loading the images. The browser doesn't know the width of an image if it hasn't loaded it, so it'll just use a default width (or a specified width) as a place holder. Are you noticing that the images are clipped when they finally do show up? In thus case, a reload would almost certainly re-center the menu properly. So, what to do? Two possibilities:

(1) First, I'd try this. Specify the width of wach image in the aI() string, so that the browser will know what width to use, even if the image isn't yet available. I.e., instead of

Code: Select all


add the imagewidth property, like so

Code: Select all


substituting your actual image width, of course. Measurement is in px. Do that for each of your main menu items.

(2) If that doesn't work, then you could write s small funciton to cache the necessary images before running the menu code, so that they are available when the menu renders. Try #1 first, and see if that fixes it before we have a go at #2.


Thanks - That 99% did it!

Poster: sketches
Dated: Tuesday April 13 2004 - 20:31:41 BST

Thank you for your suggestion - it did the trick with a minor addition ;)

I had to add the imageheight property also:

Code: Select all


otherwise the script seems to try to guess the height of the first image and baloons the menu out in height for a few seconds whilst it sorts itself out (impressive but rather odd looking effect 8O )

adding imageheight keeps the wild horse under control.

Thank you all for your help. Very much appreciated and glad to see this code is very flexible.

Poster: kevin3442
Dated: Tuesday April 13 2004 - 21:03:42 BST

Glad to help. I see that you edited the original test urls... thanks. Just to keep our own internal support logs accurate, however, it would be best if you could send us the url to the completed site, along with a permanent login. ;)