Initialize Google maps V3


/ Published in: JavaScript
Save to your folder(s)

Basic Google Maps initialize code


Copy this code and paste it in your HTML
  1. var map;
  2. function initialize() {
  3. var myLatlng = new google.maps.LatLng(51.05866,3.713379);
  4. var myOptions = {
  5. zoom: 8,
  6. center: myLatlng,
  7. streetViewControl: false,
  8. mapTypeId: "terrain",
  9. scrollwheel:false
  10. }
  11. map = new google.maps.Map(document.getElementById("'.$id.'"), myOptions);
  12. mapReady();
  13. }
  14. function mapReady() {
  15. //Go wild
  16. }
  17. function loadScript() {
  18. var script = document.createElement("script");
  19. script.type = "text/javascript";
  20. script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
  21. document.body.appendChild(script);
  22. }
  23. window.onload = loadScript;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.