JSFiddle - React, Tailwind, and code Playground
by iambnz
HTML
<script src="http://maps.google.com/maps/api/js?sensor=false&.js"></script>
<div id="map-canvas"></div>
CSS
#map-canvas {
width:100%;
height:300px;
background:red;
}
JavaScript
var startLocation = new google.maps.LatLng(36.151685,-115.152438);
function initialize() {
var mapOptions = {
center: startLocation,
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
var marker = new google.maps.Marker({
position: startLocation,
map: map,
draggable:true,
animation: google.maps.Animation.DROP,
title:"Hello World!"
});
var infowindow = new google.maps.InfoWindow();
infowindow.setContent('some content here');
google.maps.event.addListenerOnce(map, 'idle', function(){
infowindow.open(map, marker);
});
}
google.maps.event.addDomListener(window, 'load', initialize);