JSFiddle - React, Tailwind, and code Playground

by simoneast

HTML

<script src="//maps.googleapis.com/maps/api/js?version=3.exp"></script>
<div id="map" style="width: 600px; height: 500px"></div>

CSS

.infoWindow {
    font-family: sans-serif;
    font-size: 17px;
}

JavaScript

// Create map
map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: new google.maps.LatLng(-30, 145.5),
    mapTypeId: google.maps.MapTypeId.ROADMAP
});

// Create marker
var marker = new google.maps.Marker({
    position: new google.maps.LatLng(-37.8181, 145.119),
    map: map
});

// Create InfoWindow
var infoWindow = new google.maps.InfoWindow({
    content: '<div class="infoWindow">Aaa bbb ccc dddllllll</div>'
});

// Open window immediately
infoWindow.open(map, marker);

// Open again on marker click
google.maps.event.addListener(marker, 'click', function(){
    infoWindow.open(map, marker);
});