0
我試圖簡單地將Google搜索欄添加到我自己的地圖上,但遇到問題。我似乎無法讓它工作!我試過map.enableGoogleBar();但是這只是擺脫了我的KML層,並沒有添加搜索框!谷歌地圖欄
下面是代碼:
function initialize() {
// set up startup options for the map
// disabled double click as it was annoying and streetview control removed.
var myOptions = {
zoom: 10,
//minZoom: 16,
center: new google.maps.LatLng(50.45750, -3.84521),
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDoubleClickZoom: true,
streetViewControl: false,
mapTypeControl: true,
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN,
position: google.maps.ControlPosition.TOP_LEFT
},
scaleControl: true,
scaleControlOptions: {
position: google.maps.ControlPosition.BOTTOM_LEFT
}
enableGoogleBar: true,
googleBarOptions: {showOnLoad:true},
};
// create the new map
map = new google.maps.Map(document.getElementById('map_canvas'),
myOptions);
非常感謝你!我沒有意識到Google bar功能沒有傳遞給API V3 :) – Kel196