GoogleMap API - Setting The Extent
by freedawirl
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
<div id="mapDiv"></div>
CSS
#mapDiv {
height:500px;
width:500px border:1px solid red;
}
JavaScript
//Initialize Map Function
function initialize() {
//1 Map Options Object
var mapOptions = {
center: new google.maps.LatLng(30.33851, -97.831192),
zoom: 10
};
//2 Create Map
var map = new google.maps.Map(document.getElementById("mapDiv"), mapOptions);
}
/* Event Handler that listens for page load event and then calls the above "initialize function" function initialize() when the page loads */
google.maps.event.addDomListener(window, "load", initialize);