javascript - Google Map API seems to not load -
i have problem google map on website not loading there still in container except white background, indeed can see terms @ bottom right , satellite button @ top right.
there code, hope able spot wrong :
function initialize() { var mylatlng = new google.maps.latlng(49.724305, 4.716567); var mapoptions = { center: mylatlng, zoom: 17, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(mapcanvas, mapoptions); var image = { url: '/media/a.png', size: new google.maps.size(56, 67), origin: new google.maps.point(0, 0), anchor: new google.maps.point(32, 67), scaledsize: new google.maps.size(56, 67) }; var marker = new google.maps.marker({ position: mylatlng, map: map, icon: image }); } google.maps.event.adddomlistener(window, 'load', initialize());
in code mapcanvas
seems unassigned. after adding var mapcanvas = document.getelementbyid('map');
map loads intended. jsfiddle
Comments
Post a Comment