お世話になります
掲題の通りにグーグルマップのクリックした際の吹き出しを1つのみにしたい(すでに開いているウィンドウを削除)のですがうまくいきません。
現在作成中のコードを下記に示します。
ご教授いただければ幸いです。
$(function() {
var data = new Array();
$.getJSON("array.json" , function(data) {
for( var i in data){
for( var j in data[i] ){
var myMarker = new google.maps.Marker({
position: new google.maps.LatLng(data[i]["M"], data[i]["N"]),
map: myMap,
});
attachMessage(myMarker, data[i]["D"] + '</br>' + data[i]["E"]);
}
}
});
});
function attachMessage(marker,msg) {
google.maps.event.addListener(marker, 'click', function() {
new google.maps.Geocoder().geocode({
latLng: marker.getPosition()
}, function(result, status) {
if (status == google.maps.GeocoderStatus.OK) {
new google.maps.InfoWindow({
content: msg
}).open(marker.getMap(), marker);
}
});
});
}
var myMap = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: new google.maps.LatLng(34.894000, 136.930437),
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/09/07 10:25
2015/09/07 11:19
2015/09/07 12:23
2015/09/08 01:46
2015/09/09 12:40