Hey Ich habe ein Produkt Schleife, wo jedes Produkt seinen eigenen Daten-Standort hat = „number“ändert Google Maps Marker auf Klick
Ich mag nach dem Markierungssymbol auf Klick auf eine der Schaltflächen zu ändern, um die Lage sein, zu seinem Standort.
<button class="btn" data-location="80"></button>
<button class="btn" data-location="81"></button>
<button class="btn" data-location="82"></button>
so dass Marker mit Daten-location = "80" wird grün oder ändert das Bild auf Klick
hier ist meine addMarker Funktion
function addMarker(location) {
location.Position = {
lat: parseFloat(location.mapURL.split(',')[0]),
lng: parseFloat(location.mapURL.split(',')[1])
};
location.Marker = new google.maps.Marker({
icon: 'images/map-marker-blue-2.png',
map: map,
position: location.Position,
title: location.name,
});
}
lassen Sie mich wissen, wenn Sie weitere Informationen benötigen