初始化多个谷歌地图位置

时间:2016-08-06 14:52:18

标签: javascript jquery html json

由于某种原因,var mapLocation_1无法加载。我只看到背景颜色。

function initialize() {

    //bgMap
    var bgMap = new google.maps.LatLng(24.4887956, 54.3505189);
    var mapOption_bgMap = {
        center: bgMap,
        zoom: 15,
        disableDefaultUI: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var map = new google.maps.Map(document.getElementById("googleMap"), mapOption_bgMap); // bgMap
    var load_marker_bgMap = new google.maps.Marker({
        position: bgMap,
        icon: '_/images/marker-icon.png'
    });

    load_marker_bgMap .setMap(map);
    /* </bgmp> */

    //bgMap
    var mapLocation_1 = new google.maps.LatLng(29.125285,-82.048823);
    var mapOption_mapLocation_1 = {
        center: mapLocation_1,
        zoom: 15,
        disableDefaultUI: true,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var map = new google.maps.Map(document.getElementById("mapLocation_1"), mapOption_mapLocation_1); // bgMap
    var load_marker_mapLocation_1 = new google.maps.Marker({
        position: mapLocation_1,
        icon: '_/images/marker-icon.png'
    });
    load_marker_mapLocation_1.setMap(map);
    /* </bgmp> */
} //initialiseMap

google.maps.event.addDomListener(window, 'load', initialize);

1 个答案:

答案 0 :(得分:0)

$("a[data-toggle='tab']").on('shown.bs.tab', function(e) {
    initialize();
});