Skip to content

Commit

Permalink
include InfoWindow again
Browse files Browse the repository at this point in the history
  • Loading branch information
oracline committed Aug 29, 2024
1 parent b316338 commit 8f69942
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Resources/Public/JavaScript/Frontend/GoogleMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,20 @@ function ttAddressGoogleMaps() {
title: recordId,
});

google.maps.event.addListener(marker, 'click', function (e) {
infoWindow.setContent(document.getElementById('ttaddress__record-' + this.recordId).innerHTML);
infoWindow.open(obj.map, this);
marker.addListener("click", ({ domEvent, latLng }) => {
const { target } = domEvent;

infoWindow.close();
infoWindow.setContent(document.getElementById('ttaddress__record-' + marker.title).innerHTML);
infoWindow.open(marker.map, marker);

var allLabels = document.querySelectorAll('.ttaddress__label');
for (var i = 0; i < allLabels.length; i++) {
allLabels[i].classList.remove('active')
}
document.getElementById('ttaddress__label-' + this.recordId).classList.add('active');

document.getElementById('ttaddress__label-' + marker.title).classList.add('active');
});

bounds.extend(position);
obj.markers.push(marker);
}
Expand Down

0 comments on commit 8f69942

Please sign in to comment.