JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<div id="map-canvas"></div>
CSS
html, body, #map-canvas {
margin: 0;
padding: 0;
height: 100%;
}
JavaScript
function initialize() {
var myLatlng = new google.maps.LatLng(57.671431,14.976811);
var myMaplng = new google.maps.LatLng(57.671828,14.976794);
var mapOptions = {
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: myMaplng,
disableDefaultUI: true
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var contentString = '<div id="content" style="padding: 0;margin:0;">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading" style="padding: 0;margin:0;">lololol</h1>'+
'<div id="bodyContent">'+
'<p>Kaserngatan 24A<br>575 34 sdad<br></p>På den här addressen ligger vårat temporära kontor.. ' +
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: 'lololol'
});
google.maps.event.addListener(window, 'load', function() {
infowindow.open(map,marker);
});
infowindow.open(map,marker);
//################
//Comment out the line below to see the difference
map.panBy(0,-500);
}
google.maps.event.addDomListener(window, 'load', initialize);