0
我試圖圍繞Lat/Lang圍繞谷歌地圖標記。而不是中心底部,我希望它成爲中心。任何想法?拉特朗(中心,中心)周圍的中心標記位置
多謝:)
function init_map() {
var apt_latlang = new google.maps.LatLng(32.071197, 34.778754);
var var_location = apt_latlang;
var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var isDraggable = w > 480 ? true : false;
var dorbel_map_styles = [ { "featureType": "water", "stylers": [ { "color": "#2A80B9" } ] },{ "elementType": "labels.text.fill", "stylers": [ { "color": "#382E2F" } ] },{ "elementType": "labels.text.stroke", "stylers": [ { "visibility": "off" } ] },{ "featureType": "road", "elementType": "labels.text.fill", "stylers": [ { "color": "#7F7F7F" } ] },{ "featureType": "landscape.man_made" } ]
var var_mapoptions = {
center: var_location,
disableDefaultUI: true,
navigationControl: false,
scaleControl: false,
scrollwheel: false,
mapTypeControl: false,
styles: dorbel_map_styles,
zoom: 15,
draggable: isDraggable,
scrollwheel: false
};
var marker = new google.maps.Marker({
position: apt_latlang,
map: var_map,
icon:'assets/images/dorbel_marker.svg'
});
var var_map = new google.maps.Map(document.getElementById("map"),
var_mapoptions);
marker.setMap(var_map);
}
https://developers.google.com/maps/documentation/javascript/markers這有你所需要的,下「標記標籤」我認爲它向您展示瞭如何將標記添加到中心。 –
'未捕獲的ReferenceError:myLatlng未定義' – geocodezip