Menu Align Center Help Please

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

Menu Align Center Help Please

Post by sketches »

I have used the command:

screenposition="center";

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?

Thanks!
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

URLs, as requested, really help us to help you a lot better.
John
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

URL

Post by sketches »

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.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

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.

Thanks.
John
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

URL

Post by sketches »

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)

http://deleted_too_adult/personals/test.htm

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")){
style=menuStyle;
top=5;
screenposition="center";
menualign="center";
align="center";
alwaysvisible=1;
orientation="horizontal";
Thanks for your thoughts

Martin
Last edited by sketches on Tue Apr 13, 2004 7:31 pm, edited 1 time in total.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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.

Ruth
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

css

Post by sketches »

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.
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

One useful observation

Post by sketches »

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)

Useful?

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
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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

aI("url=whatever.htm;image=imageName.gif;");
add the imagewidth property, like so

Code: Select all

aI("url=ehatever.htm;image=imageName.gif;imagewidth=130;");
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.

Kevin
sketches
Beginner
Beginner
Posts: 6
Joined: Mon Apr 12, 2004 2:07 am

Thanks - That 99% did it!

Post by sketches »

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

I had to add the imageheight property also:

Code: Select all

imagewidth=105;imageheight=28;
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.
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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. ;)

Kevin
Post Reply