close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Google map v3 hidden tabbed panels not centering

Thread began 2/23/2012 4:06 pm by kimholt436260 | Last modified 2/29/2012 1:15 pm by kimholt436292 | 6900 views | 7 replies |

kimholt436260

Google map v3 hidden tabbed panels not centering

Hiya,
I am trying to put a different google map on each tab of a tabbed panel. The map on the default page works fine but the ones on other tabs appear only in the top left of the container div. From what I have read this is due to the hidden container divs having a size(0,0) so the google map centres in the top left and doesn't resize when the tab is activated.

I realise this is a known bug and a lot of people seem to have fixed it in version 2, but not version 3 google maps. Unfortunately none of the fixes seem to have worked for me. I think the code fixes might work but I'm sure sure where to insert them into the javascript?

I'm hoping someone could help me work out what code to put where to get the google maps on the hidden tabbed panels to either resize when the tab is activated, or be made permanetly the correct size?

Code below:

(header)
<script type="text/javascript">

function initDexGoogleMap(canvas, width, w_unit, height, h_unit, latitude, longitude, p_zoom, p_mapType, p_navControl, p_navStyle, p_navPosition, p_mapTypeC, p_mapTypeCStyle, p_mapTypeCPosition, p_scaleC, p_scaleCPosition, p_draggable, p_disableDoubleClickZoom, p_keyboardShortcuts, p_trafficL, p_bikeL, p_panoramio )

{document.write('<div id="'+canvas+'"></div>');

document.getElementById(canvas).style.width = width + w_unit; document.getElementById(canvas).style.height = height + h_unit;

var latlng = new google.maps.LatLng(latitude,longitude);
var myOptions = {zoom: p_zoom, center: latlng, navigationControl: p_navControl, navigationControlOptions: {style: p_navStyle, position: p_navPosition}, mapTypeControl: p_mapTypeC, mapTypeControlOptions: {style: p_mapTypeCStyle, position: p_mapTypeCPosition}, scaleControl: p_scaleC, scaleControlOptions:
{position: p_scaleCPosition}, mapTypeId: p_mapType, draggable: p_draggable, disableDoubleClickZoom: p_disableDoubleClickZoom, keyboardShortcuts: p_keyboardShortcuts};

var map = new google.maps.Map(document.getElementById(canvas), myOptions);

(Body)

<div id="DEX_GContainer0">
<script type="text/javascript">var my_DEX_GContainer0 = initDexGoogleMap
("DEX_GContainer0","450","px","450","px",51.5313695, -0.1031838,16,google.maps.MapTypeId.ROADMAP,true,google.maps.
NavigationControlStyle.DEFAULT,google.maps.ControlPosition.TOP_LEFT,true,google.maps.MapTypeControlStyle.DEFAULT,google.maps.ControlPosition.TOP_RIGHT,true,google.maps.ControlPosition.BOTTOM_LEFT,true,false,true,false,false,false); addMarker(my_DEX_GContainer0,51.5313695,-0.1031838,false,"Fitness%20First","","","click","");
</script>
</div>

Thanks!

Sign in to reply to this post

Jason ByrnesWebAssist

please send a link where i can see the problem to investigate.

Sign in to reply to this post

kimholt436292

Link to google map problem

Hi,
Thank you, link is below. The map works perfectly on the default 'London' tab but doesn't work properly on the 'South West' tab.

Locations.html

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

i am not able to see the page at the link you provide. All i see is:
This domain name has been reserved for future use

Sign in to reply to this post

kimholt436292

website

Hi,
OK, the site must still be propagating as I only transferred it to the new host this morning.

Locations.html is the testing area I'm using and has exactly the same code,

I have got to the point where the map in the 'South West' tab map will resize if the map is dragged slightly by adding the following code:

var map = new google.maps.Map(document.getElementById(canvas), myOptions);

google.maps.event.addListener(map, "idle", function()
{google.maps.event.trigger(map, 'resize'); });

How can I get the map to resize without the user having to drag it? (maybe by zooming in and back out again automatically?)
How can I get the map to recentre around the marker rather than still being centred in the top left?

Thanks

Sign in to reply to this post

kimholt436292

possible solutions

Hi,
I have read that possible solutions would be:

google.maps.event.trigger({map}, 'resize'); {map}.setCenter({marker}.getPosition());

map.setZoom( map.getZoom() );

this.map.setZoom( this.map.getZoom() - 1);
this.map.setZoom( this.map.getZoom() + 1);

map.setZoom(map.getZoom());
map.fitBounds(bounds);

I haven'be been able to get any of these to work, but I'm not sure I'm using them correctly. Where could these go and what would it look like in my code above?

Really appreciate any help anyone can give me!

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

It looks like you have found the solution to this? When i visit your page the maps appear to be loading ok?

Sign in to reply to this post

kimholt436292

Hi, I found a workaround using jQuery tabs rather than sort tabs and the standard google map rather than the webassist google map. I don't mind using jQuery tabs but it would be nice to use the wabassist google map rather than the basic one, but I couldn't get the maps to work.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...