yudaduy

Simple Marker Example

Sep 20th, 2021 (edited)
475
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <title>Marker Clustering</title>
  5.     <style>
  6.         /* Always set the map height explicitly to define the size of the div
  7.        * element that contains the map. */
  8.         #map {
  9.         height: 100%;
  10.         }
  11.  
  12.         /* Optional: Makes the sample page fill the window. */
  13.         html,
  14.         body {
  15.         height: 100%;
  16.         margin: 0;
  17.         padding: 0;
  18.         }
  19.     </style>
  20.  
  21.     <!-- jsFiddle will insert css and js -->
  22.   </head>
  23.   <body>
  24.     <div id="map"></div>
  25.  
  26.     <!-- Async script executes immediately and must be after any DOM elements used in callback. -->
  27.     <script
  28.      src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap&v=weekly&channel=2"
  29.      async
  30.    ></script>
  31.  
  32.     <script>
  33.    
  34.       function initMap() {
  35.         var myLocation = { lat: -28.024, lng: 140.887 };
  36.         var map = new google.maps.Map(document.getElementById('map'), {
  37.         zoom: 7,
  38.         center: myLocation,
  39.         });
  40.  
  41.         new google.maps.Marker({
  42.             position: myLocation,
  43.             map,
  44.         });
  45.     }
  46.     </script>
  47.   </body>
  48. </html>
RAW Paste Data