JSFiddle - React, Tailwind, and code Playground
by Kyle Lam
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<div id="map-canvas"></div>
CSS
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
JavaScript
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(50.2014, 8.5804 ),
zoom: 16,
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: false,
panControl: true,
draggable: false
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
mapOptions);
var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(50.2014, 8.5804 ),
title:"Schmerzzentrum"
});
var contentString = '<div id="mapinfo_box" style="color:#666;max-width:280px;">'+
'<h1 id="mapinfo_h1">Schmerzzentrum</h1>'+
'<div id="mapinfo_body">'+
'<p style="font-size:16px;margin-bottom:15px;">Rathausplatz 6 <br />61440 Oberursel (Taunus)</p>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
google.maps.event.addDomListener(window, 'resize', initialize);
google.maps.event.addDomListener(window, 'load', initialize)