if i click in my marker it showing in give radius but if i click on another marker the pervious marker shouldn't display in radius is should be display in normal? how to insert setNull to the marker and where should to inser in my code?
`var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addListener(marker, 'mouseover', (function(marker, i) { return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker, this);
marker.addListener('click', function() {
var circle = new google.maps.Circle({
map: map,
radius: 909, // 10 miles in metres
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#AA0000'
});
circle.bindTo('center', marker, 'position');
map.setCenter(marker.getPosition());
document.getElementById("map").style.width = "50%";
google.maps.event.trigger(map, 'resize')
map.setCenter(marker.getPosition());
document.getElementById("data").style.display = "inline";
document.getElementById("data").innerHTML = locations[i][0] + "<br />" + locations[i][4] + "<br />" + locations[i][5] + "<br />" + locations[i][6] + "<br />" + '<div class="row"><div class="col-md-4"><img class="img-responsive" src="' + locations[i][7] + '" /></div></div>';
document.getElementById("button").style.display = "block";
});
}
})(marker, i, infowindow));
google.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
}`
Aucun commentaire:
Enregistrer un commentaire