我在使用 iframe 将我的标记居中时遇到问题
示例 here ,您单击“ map ”选项卡,但标记未居中。如果没有 iframe 的直接链接看起来很棒。可以看到 here .
var myOptions = {
zoom: 12,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
center: myLatlng
看起来无法在带有 iframe 的选项卡中使用。我该如何解决?让我知道
最佳答案
我曾经遇到过类似的问题,我能够通过触发调整大小事件并在单击选项卡时再次设置中心来解决它。
// add this to the tab click event
google.maps.event.trigger(map, 'resize');
map.setCenter(myLatlng);
关于javascript - 如何使用 iframe 在选项卡中居中我的 Google map 标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5536343/