1 ページに 2 つの Google マップを表示したいのですが、何らかの理由で 2 つ目のマップが壊れています。
私が使用しているコードは次のとおりです。
<style>
#map-london {
width: 500px;
height: 400px;
}
#map-belgium {
width: 500px;
height: 400px;
}
</style>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(51.518865,-0.133108);
var mapOptions = {
zoom: 17,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map-london'), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'Incopro London'
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<script>
function initializeB() {
var myLatlngBel = new google.maps.LatLng(50.802138,-1.07839);
var mapOptionsBel = {
zoom: 17,
center: myLatlngBel,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var mapB = new google.maps.Map(document.getElementById('map-belgium'), mapOptionsBel);
var markerB = new google.maps.Marker({
position: myLatlngBel,
map: mapB,
title: 'Incopro Belgium'
});
}
google.maps.event.addDomListener(window, 'load', initializeB);
</script>
次に、2 つの div を使用してマップを表示しています。
<div id="map-london"></div>
<div id="map-belgium"></div>
これを修正する方法を知っている人はいますか?
前もって感謝します。