diff --git a/content/body/maps.php b/content/body/maps.php index a8061d26..98fbbef3 100644 --- a/content/body/maps.php +++ b/content/body/maps.php @@ -4,15 +4,32 @@ Accessible Map with List View - @@ -44,12 +61,8 @@
- -
-

The following is the map container

- -
-
+
+

The following is the map container

@@ -61,43 +74,63 @@ - + + let map; + let currentFocusIndex = 0; + const locations = [ + { id: 1, name: 'North office', coords: { lat: 25.7617, lng: -80.1918 }, description: 'First location description' }, + { id: 2, name: 'East office', coords: { lat: 25.7637, lng: -80.1910 }, description: 'Second location description' }, + { id: 3, name: 'West office', coords: { lat: 25.7657, lng: -80.1920 }, description: 'Third location description' } + ]; + + function initMap() { + map = new google.maps.Map(document.getElementById('map'), { + center: { lat: 25.7617, lng: -80.1918 }, + zoom: 13 + }); + + locations.forEach((location, index) => { + const marker = new google.maps.Marker({ + position: location.coords, + map: map, + title: location.name + }); + + const infoWindow = new google.maps.InfoWindow({ + content: `${location.name}
${location.description}` + }); + + marker.addListener('click', () => { + infoWindow.open(map, marker); + }); + + + + + + const listItem = document.createElement('li'); + const button = document.createElement('button'); + button.innerText = location.name; + + button.setAttribute('aria-label', `${location.name}`); + button.setAttribute('aria-describedby', `${location.description}`); + button.onclick = () => { + map.setCenter(location.coords); + map.setZoom(15); + infoWindow.open(map, marker); + }; + listItem.appendChild(button); + document.getElementById('location-list').appendChild(listItem); + + }); + + + + } + + +