map won't display in jQuery tabs nested inside jQuery accordion

299 views
Skip to first unread message

Keith Brown

unread,
Aug 25, 2011, 7:57:47 AM8/25/11
to google-map...@googlegroups.com
I've read through several places talking about how a map won't render properly unless you make sure the div is set before attempting to initialize your map.  Therefore, you should use setTimeout() or one of jQuery's events that trigger after the new display is rendered.  This isn't working for me.  I have a robust layout made of a series of accordions; some of the accordions include nested tabs.  I'm trying to display my map in a tab that is nested inside an accordion.  I've tried using setTimeout and jQuery's "show:" events with no success.  I've even combined them to no avail.  Firebug still gives me an error that computed size is returning a failure code.  When I look at my div in firebug it shows a computed size, so I don't understand why this is happening.  Any help would be greatly appreciated.
my map link
 when you open the page, the accordion view holding the maps is displayed with "map 1" tab showing. Click on "map 2" tab to get my error, this is where I'm trying to render the map.

Andres Ferrate

unread,
Aug 25, 2011, 11:44:19 AM8/25/11
to google-map...@googlegroups.com
Keith,

Try changing your initMap2() function to use document.getElementById instead of using the jQuery method.

Example:

var mapDiv = document.getElementById('map2');

Cheers,

Andres



--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/HAPui9MYWRIJ.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Keith Brown

unread,
Aug 25, 2011, 7:08:09 PM8/25/11
to google-map...@googlegroups.com
Thanks! That was it. For the other noobs like me I found this explanation:
http://stackoverflow.com/questions/6103766/diference-between-getelementbyid-and-jquery-smth
Reply all
Reply to author
Forward
0 new messages