Reputation: 1053
I am opening google map in bootstrap modal. When I click on link to open google map modal, it is showing well, after close modal if I am open google map modal second time map is not showing as open first time check images to understand problem
please check first image,in that pullen park(one park is showing on map) is showing bottom right corner but when I open google map modal again pullen park is showing top left corner,so why pullen park is not showing same as first image.
Upvotes: 2
Views: 2627
Reputation:
simply just put
google.maps.event.addListener(map, 'resize', function() {
map.setCenter(marker.getPosition());
});
Upvotes: 1
Reputation: 4784
It is probably due to some hiding issues. You might want to recenter your map after you do google.maps.event.trigger(map, 'resize');
, or listen to the resize event like the following:
google.maps.event.addListener(map, 'resize', function() {
console.log("resize triggered");
});
for more about resize: https://developers.google.com/maps/documentation/javascript/reference
for more about event: https://developers.google.com/maps/documentation/javascript/events
Upvotes: 1