Skip to content

Instantly share code, notes, and snippets.

@xDarkicex
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save xDarkicex/84517e5af85a4c96754e to your computer and use it in GitHub Desktop.

Select an option

Save xDarkicex/84517e5af85a4c96754e to your computer and use it in GitHub Desktop.
Google map dynamic sizing
<body>
<div id="map-canvas"></div>
</body>
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644)
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp' +
'&signed_in=true&callback=initialize';
document.body.appendChild(script);
}
window.onload = loadScript;
html, body, #map-canvas {
height: 30rem;
width:30rem;
margin: 0px;
padding: 0px
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment