0

在我的地图下面有一个盒子,我可以离开。我的索引有一张主地图,还有一张地图可供展示。我有两个不同的地图选项。当我查看我的页面源代码时,我看到了两个地图的脚本。我无法弄清楚为什么会这样。

<script type="text/javascript" charset="utf-8">
Gmaps.map = new Gmaps4RailsGoogle();
Gmaps.load_map = function() {
Gmaps.map.map_options.auto_adjust = true;
Gmaps.map.initialize();
Gmaps.map.markers = [{"description":"test, 217 cleveland ave , liverpool, This is some additional information.","lat":43.1155,"lng":-76.2292},{"description":"bah, 215 university place, syracuse, ","lat":43.0396,"lng":-76.1355}];
Gmaps.map.markers_conf.do_clustering = true;
Gmaps.map.create_markers();
Gmaps.map.adjustMapToBounds();
Gmaps.map.callback();
};
window.onload = function() { Gmaps.loadMaps(); };
</script>


    <script type="text/javascript" src="//maps.google.com/maps/api/js?v=3.8&sensor=false&libraries=geometry&language=&hl=&region="></script>


`<script type="text/javascript" charset="utf-8">
Gmaps.map = new Gmaps4RailsGoogle();
Gmaps.load_map = function() {
Gmaps.map.map_options.auto_adjust = true;
Gmaps.map.map_options.auto_zoom = false;
Gmaps.map.map_options.zoom = 10;
Gmaps.map.map_options.detect_location = true;
Gmaps.map.map_options.center_on_user = false;
Gmaps.map.initialize();
Gmaps.map.markers = [{"description":"test, 217 cleveland ave , liverpool, This is some additional information.","lat":43.1155,"lng":-76.2292},{"description":"bah, 215 university place, syracuse, ","lat":43.0396,"lng":-76.1355}];
Gmaps.map.create_markers();
Gmaps.map.adjustMapToBounds();
Gmaps.map.callback();
};
window.onload = function() { Gmaps.loadMaps(); };
</script>`
4

1 回答 1

0

我通过将 .map_container 设置为地图高度的两倍来修复它。我的地图高度是 400 像素,我的地图容器高度是 200 像素。我仍然不知道为什么会这样。

于 2012-04-26T19:02:00.500 回答