i have a page and a google map is inside a hidden div at first. I then show the div after i click a link but only the top left of the map shows up.
i tried having this code run after the click:
map0.onResize();
or:
google.maps.event.trigger(map0, 'resize')
any ideas. here is an image of what i see after showing the div with the hidden map in it.
use this line of codes when you want to show map.
Add this code before the div or pass it to a js file:
This event will be triggered after the div loads so it will refresh the map content without having to press F5
Upon showing the map I am geocoding a address then setting the maps center. The
google.maps.event.trigger(map, 'resize');
did not work for me.I had to use a
map.setZoom(14);
Code below:
I've found this to work for me:
to hide:
to show:
If used inside Bootstrap v3 tabs, the following should work:
where
tab-location
is the ID of tab containing map.