On Jan 8, 11:12 am, an <[email protected]> wrote: > Hello! > > I use google maps in tabs so i resize it. But... but does my map not > center to my marker after resize... >
Same problem here... On Jan 9, 2:50 pm, Rossko <[email protected]> wrote: > > This is my cod, please help me. > > Insufficient information, can't see all the context. > Please give a link to your map page showing the problem. > > Best guess is that you are triggering the resize before the tab is > shown. Which information did you miss? How to reproduce: 1) create the following code: <div id="tabs"> <div id="first_tab">lorem ipsum dolor...</div> <div id="second_tab"> <div id="gmap" style="width:600px;height:300px;"></div> </div> </div> <!-- include google maps api v3 --> <!-- include jquery --> <!-- include jquery ui --> <script> $(function() { if(typeof google != "undefined") { // create map in div#gmap with a marker at the center } $('#tabs').tabs({ selected: 0, // force to open the first tab when rendering tabs show: function( event, ui ) { if( ui.panel.id == 'second_tab' && typeof map != "undefined") { google.maps.event.trigger( map, 'resize' ); } } }); }) </script> 2) open the page. -> you only should see the first tab ("lorem ipsum dolor...") 3) click the second tab. -> it shows the google map, except the marker is at the top left corner instead of the center. The marker is placed correctly based on the LatLon, but the map isn't centered anymore. Also when you dump map.getCenter() before and after the resize you can see the center has moved. Before: (52.3105, 4.9321) // is added to google.maps.LatLng() and used for centering map and marker After: (52.29475459838935, 4.9835984130859545) // dumped after the resize I hope this is enough ionformation... -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
