I got a problem to center my marker in tab with iframe
Example here , you click on Map tab and the marker is not centered. If direct link without iframe it looking great. You can see here .
var myOptions = {
zoom: 12,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
The center: myLatlng
looks like not working in tab with iframe. How do I fix this? Let me know
I had a similar problem once and I was able to solve it by triggering a resize event and setting the center again when the tab is clicked.
// add this to the tab click event
google.maps.event.trigger(map, 'resize');
map.setCenter(myLatlng);
I had a same problem. Solve this with window resize
google.maps.event.addDomListener(window, "resize", function() {
var center = map.getCenter();
google.maps.event.trigger(map, "resize");
map.setCenter(center);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.