谷歌地图位置Right_Center不工作

时间:2014-05-05 08:20:50

标签: google-maps google-maps-api-3

我正在使用谷歌地图,并希望该职位为RIGHT_CENTER。但这对我不起作用。请帮我解决这个问题。谢谢。

代码:

var contact = { "lat": "****", "lon": "***" }; // Change a map coordinate here!

try {
    var mapContainer = $('#map');
    mapContainer.gmap3({
        action: 'addMarker',
        latLng: [contact.lat, contact.lon],
        map: {
            center: [contact.lat, contact.lon],
            zoom: 17,
            mapTypeControl: true,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
                position: google.maps.ControlPosition.RIGHT_CENTER // This is not working 
            },
        },
    },   { action: 'setOptions', args: [{ scrollwheel: true }] }  );    }

1 个答案:

答案 0 :(得分:0)

看起来你正在使用gmap3 jquery插件。您应该在options属性中指定所有地图选项(我猜其他选项也不起作用),请参阅here

像这样:

var mapContainer = $('#map');
mapContainer.gmap3({
    marker:{
        latLng: [45,-10], 
    },
    map: {
        options: {
            center: [45,-10],
            zoom: 5,
            mapTypeControl: true,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
                position: google.maps.ControlPosition.RIGHT_CENTER // This is not working 
            }
        }
    },
},   { action: 'setOptions', args: [{ scrollwheel: true }] }  );    

see demo

相关问题