1
我試圖在我的網站上自定義並添加Google地圖地圖。以編程方式在Google地圖上添加「在Google地圖上查看」自定義按鈕
我能夠以編程方式使用谷歌地圖JS API添加它,地圖上正確顯示和下面的代碼(see fiddle here)的一切:
function initialize() {
var map_canvas = document.getElementById('map-canvas');
var map_options = {
disableDefaultUI : false,
center: new google.maps.LatLng(41.9100711,12.5359979),
zoom: 17,
mapTypeId: google.maps.MapTypeId.HYBRID,
scrollwheel : false,
zoomControl : true,
streetViewControl : false,
scaleControl : true,
}
var map = new google.maps.Map(map_canvas, map_options);
var marker = new google.maps.Marker({
map : map,
position : new google.maps.LatLng(41.9100711,12.5359979),
title : "Title"
});
var info = new google.maps.InfoWindow({
content : "marker content"
});
google.maps.event.addListener(marker, "click", function(){
info.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
現在,我想補充的「打開在谷歌地圖」按鈕:
爲了讓用戶瀏覽地圖,並獲得方向的標記指向的地方。
我正在閱讀documentation,但我只能找到「url示例」,並沒有任何與JS配置我的地圖相關。
任何人有任何建議嗎?
謝謝