我正在为一个新项目使用 Google 地图,但是当我打开一个infoWindow
.
见下图:
有没有人认识到这个问题?
这是我的地图初始化代码:
$(document).ready(function(){
function initialize() {
var myLatlng = new google.maps.LatLng(59.398554, 5.486206);
var mapOptions = {
draggable: true,
zoomControl: true,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID]
}, // here´s the array of controls
disableDefaultUI: true, // a way to quickly hide all controls
scrollwheel: false,
zoom: 13,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h2 id="firstHeading" class="firstHeading">FjørSilkeBris</h2>'+
'<div id="bodyContent">'+
'<p>Førland, 5570 Aksdal</p>'+
'<p>481 49 246 (Mobil)</p>'+
'<p>Facebook: <a href="https://www.facebook.com/FjorSilkeBris">FjørSilkeBris på facebook.</a></p>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title:"Fjørsilkebris"
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
};
window.onload = function () {
initialize();
}
});