Answer the question
In order to leave comments, you need to log in
How to track active marker on google map?
There is a map. It is necessary that by clicking on a certain marker information about the store is displayed in a separate block on the same page. At the moment I have implemented only clicks on the marker. Then I think to add an attribute to each marker and track which marker was clicked. But how to do this, I did not find the answer. Maybe someone came across tell me how to implement it.
Answer the question
In order to leave comments, you need to log in
var marker = new google.maps.Marker({
position : latlng,
map : map,
id : point.id //Тут идентификатор маркера
});
google.maps.event.addListener(marker, 'click', function() {
console.log(marker.id);
$('[data-id="'+marker.id+'"]').show(); //Показываем блок с информацией о этом маркере
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question