Zach Starnes
Zach Starnes

Reputation: 3198

Google maps api not showing

I am trying to use the google maps api. The only problem is that the map won't show all I get is a gray box.

here is the code:

function initialize() {
    var map_canvas = document.getElementById('map_canvas');
    var mapOptions = {
        center: new google.maps.LatLng(33.748995, -84.387982),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.TERRAIN
    }
    var map = new google.maps.Map(map_canvas);
}

google.maps.event.addDomListener(window, 'load', initialize)

here is the css:

#map_canvas {
    max-width: 1040px;
    height: 400px;
}

Upvotes: 1

Views: 469

Answers (1)

Dr.Molle
Dr.Molle

Reputation: 117334

You forgot to pass the mapOptions as 2nd argument:

var map = new google.maps.Map(map_canvas,mapOptions);

Upvotes: 3

Related Questions