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.
My solution was:
CSS:
jQuery:
I had a Google map inside a Bootstrap tab, which wasn't displaying correctly. This was my fix.
I was having the same problem and discovered that when show the div, call
google.maps.event.trigger(map, 'resize');
and it appears to resolve the issue for me.If you don't have variable map available, it should be the first element (unless you did something stupid) in the
div
that contains GMAP.Just as John Doppelmann and HoffZ have indicated, put all code together just as follows in your div showing function or onclick event:
It worked perfectly for me