By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,259 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,259 IT Pros & Developers. It's quick & easy.

GMap disappears when two onload functions are used in <body> tag.

P: 33
Hello,

Thanks for taking the time to help. I'm having a problem with GMap and IE7 (could be occurring in earlier versions). First let me give you a link to the problem:

problem

The problem seems to manifest itself initially when you mouse over the "Choose a different route >>" link (which has onmouseover event to change font styles). It seems that having two functions in the onload command of the <body> tag is causing the map to disappear, and I can't for the life of me figure this out. One function is loading the map into the "map" DIV, and the other is loading route data into a separate hidden DIV (viewable when clicking the problem link).

I am using scriptaculous to incorporate DIV slide effects for the hidden DIV, could this be causing the problem? Please let me know if any clarification is needed.
Jan 19 '09 #1
Share this Question
Share on Google+
8 Replies


Dormilich
Expert Mod 5K+
P: 8,639
@flydev
can't verify that, the hovers toggle the colour (map stays where it is) and the click brings up the new route....

tested on FF 3.0.5 / Mac OS X

by the way, wouldn't it be easier to use CSS' :hover pseudo-class for the colour change?
Jan 19 '09 #2

P: 33
@Dormilich
It only appears to happen in IE for some reason...Chrome and FF work fine.

by the way, wouldn't it be easier to use CSS' :hover pseudo-class for the colour change?
Yea, but I was being lazy, that was the only link i was working with at the time and didn't want to change all my style sheets. I changed it to a:hover now to avoid any confusion.
Jan 19 '09 #3

P: 33
Since I removed the onmouseover event, it doesnt happen when you mouse over the link, only when you click on it....that seems to imply this occurs whenever another javascript function is being executed.
Jan 19 '09 #4

P: 33
I moved all the javascript I could to the <head> section, and I am now using jquery instead of scriptaculous...this didn't help...it seems whenever ANY function or javascript is being called after the map is loaded, causes it to disappear....again, only in IE

You can duplicate this by click "Show more routes >>"...this triggers the listener in the <head> section to animate the DIV.
Jan 20 '09 #5

acoder
Expert Mod 15k+
P: 16,027
There's an error: "map is undefined" or "map is null or not an object" depending on the browser. I've not checked, but that may possibly be the source of the problem.
Jan 21 '09 #6

Dormilich
Expert Mod 5K+
P: 8,639
maybe it helps to include the ajax script as the last one (if you execute your script before google defines its map object.....)
Jan 21 '09 #7

P: 33
@acoder
Unfortunately not, that was just a function to trigger a map.checkResize I wrote to try to fix this, but it didn't fix the problem. I removed it. The map is now sized explicitly within the GMap function (instead of pulling its size from the DIV container)..so the map.checkResize is no longer applicable, but the problem still persists.

maybe it helps to include the ajax script as the last one (if you execute your script before google defines its map object.....)
Well, I did have both functions included in the onload of the <body> tag (GMap first, AJAX second), but that seemed to cause the map to disappear immediately. Now the onload only contains the GMap function, and the AJAX script is triggered by window.onload...that seemed to prevent the map from disappearing immediately.

The problem doesn't seem to be the AJAX, it seems to be the DIV resize...whenever a DIV is being resized (not the GMap DIV), it causes the map to disappear.
Jan 21 '09 #8

P: 33
LOL, you know what...im about to smash something if i keep trying to figure this out, I'm 99% sure its just a bug when contents get redrawn on a page the map disappears in IE...I'll just have to use an iFrame (i hate iframes)...thanks much for your help guys!!
Jan 21 '09 #9

Post your reply

Sign in to post your reply or Sign up for a free account.