Mac IE positioning problem fix/work-around

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
iwbyte
Beginner
Beginner
Posts: 8
Joined: Fri Jun 25, 2004 6:21 pm
Location: Orange County, CA, USA
Contact:

Mac IE positioning problem fix/work-around

Post by iwbyte »

I just finished spending a couple hours finding a work-around to the whole "IE for Mac doesn't play nice" issue. Its a kludge, and for some may not be a solution, but it works for me.

We're using the popup() method to call the menus, since we want our site navigatable w/out javascript and for other reasons.

Of course, we're using a table for layout, which means that Mac IE messes up the positioning of the popup menus.

so the solution for me was to have two menu_data.js files - one for IE for Mac, and one for everyone else.

Here's what I did - in the header of my pages, I use the following in place of the standard script call:

Code: Select all

	<SCRIPT language="JavaScript" src="/milonic_src.js" type="text/javascript"></SCRIPT>
	<script	language="JavaScript">
	if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/mmenuns4.js><\/scr"+"ipt>");		
	  else _d.write("<scr"+"ipt language=JavaScript src=/mmenudom.js><\/scr"+"ipt>"); 
	if ((navigator.platform == "MacPPC") && (navigator.appName =="Microsoft Internet Explorer")) _d.write("<scr"+"ipt language=JavaScript src=/menu_data_ie.js><\/scr"+"ipt>");
	else _d.write("<scr"+"ipt language=JavaScript src=/menu_data.js><\/scr"+"ipt>");
	</script>
Therefore IE for mac uses the /menu_data_ie.js data file, which has top and left ofsets that are correct for the distance from the table.

So yes, i'm doing double work, and if I ever change the menu I have to do it twice, but at least it works, and I don't have to redo my whole table/menu!

Of course, this still doesn't fix the 'pop-up-once-only-until-i-refresh' issue I get with IE for Mac - anyone got a solution for that one?

e.g. http://www.betham.org/

Hope this helps someone else!
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Thanks for the info.

I was wondering if you had tried using popup() to open a menu at an image's position, rather than at a position specified in the menu definition? In other words:

Code: Select all

popup("menuName", "imageName", topOffset, leftOffset);
To do this:

(1) Set the name= and id= attributes in the <img> tag; use the same value for both. The name/id you use becomes the second parameter passed to popup().

(2) Remove the top= and left= properties from the menu definition.

The third and fourth parameters passed to popup() are top and left offsets... i.e., the number of pixels to move the menu from the position of the image that's used as the anchor. If you try it, you may find that the top and left offsets still need some adjusting between Mac/IE and other browsers. I don't have a Mac, so I can't test. If the offsets do vary between Mac/IE and other browsers, then you could make the adjustments with conditionals and variables in one menu_data.js file, if you didn't want to maintain two separate files.

Also, there are a couple of built-in global variables that you might find useful in your browser tests: mac and mac45. if (mac) returns true for any version of IE on a Mac. if (mac45) returns true for IE 4.5 on a Mac. If nothing else, these might be useful in your sniffing for IE on a Mac in your .html file. These globals are available after milonic_src.js is loaded. There's a list of other globals on this page.
iwbyte wrote:Of course, this still doesn't fix the 'pop-up-once-only-until-i-refresh' issue I get with IE for Mac - anyone got a solution for that one?
I don't know if I missed that one in another post. If you can point to the particular post, or describe it again here, I might have an idea or two.

Cheers,

Kevin
User avatar
iwbyte
Beginner
Beginner
Posts: 8
Joined: Fri Jun 25, 2004 6:21 pm
Location: Orange County, CA, USA
Contact:

Post by iwbyte »

Kevin,

Thanks - I guess I need to do some RTFM and check out those suggestions.

As far as the other issue, here's that post:

viewtopic. ... ght=#24369
Post Reply