JSFiddle - React, Tailwind, and code Playground
by Swapnil Navalakha
JavaScript
"use strict";
// This example displays a marker at the center of Australia.
// When the user clicks the marker, an info window opens.
function initMap() {
const uluru = {
lat: -25.363,
lng: 131.044
};
const uluru2 = {
lat: -25.368,
lng: 131.048
};
const map = new google.maps.Map(document.getElementById("map"), {
zoom: 4,
center: uluru
});
const contentString = `12345566778`
const infowindow = new google.maps.InfoWindow({
content: contentString
});
/* infowindow.open(); */
const infowindow2 = new google.maps.InfoWindow({
content: contentString
});
const marker = new google.maps.Marker({
position: uluru,
map,
title: "Uluru (Ayers Rock)"
});
const marker2 = new google.maps.Marker({
position: uluru2,
map,
title: "Uluru11 (Ayers Rock)"
});
infowindow.open(map, marker);
infowindow2.open(map, marker2);
/* marker.addListener("click", () => {
infowindow.open(map, marker);
}); */
}