When I drag my location marker, it needs to update other markers as I work with a radius. Therefore, if I drag my location around, it should remove markers that are outside the radius, and add markers inside the radius. He does this, but he continues to add the same markers as 8 times or so, and of course no one wants it.
google.maps.event.addListener(marker, 'drag', function() {
geocoder.geocode({'latLng': marker.getPosition()}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[0])
{
$('#address').val(results[0].formatted_address);
ownlat = marker.getPosition().lat();
ownlng = marker.getPosition().lng();
clearOverlays();
getevents();
}
}
});
});
source
share