Answer the question
In order to leave comments, you need to log in
How to remove an event handler in Google Maps?
Removing event handlers in Google Maps is described here . How to apply this information in my case? Can't figure out how to do this if a loop is applied.
document.getElementById('myCheckbox').addEventListener('change', function() {
if (this.checked) {
for (var i = 0; i < markers.length; i++) {
var listener = google.maps.event.addListener(markers[i], 'dblclick', function() {
map.setZoom(17);
map.panTo(this.getPosition());
});
}
} else {
// Тут должно произойти удаление обработчиков, что-то типа
// google.maps.event.removeListener(listener);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question