Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="demo-card-wide mdl-card mdl-shadow--2dp">
  <div id="map"></div>
</div>
    <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBERShUthQqBT0gGIoyIxtvtjmSwrflYS8&callback=initMap">
    </script>
              
            
!

CSS

              
                html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #FAFAFA;
}
.demo-card-wide {
  margin:50px;
  height: 600px;
  width: 1280px;
}
#map {
  height: 100%;
  width: 100%;
}
              
            
!

JS

              
                function initMap() {
  
  var myLatLng = {
    lat: 52.078874, 
    lng: 4.312620
  };

  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 17,
    center: myLatLng
  });
   
// Using the function to create multiple markers
  geocodeLatLng("52.077937, 4.311377","Apple Store","Apple Inc. is an American multinational technology company headquartered in Cupertino, California, that designs, develops, and sells consumer electronics, computer software, and online services.");
  geocodeLatLng("52.079572, 4.313265","Ridderzaal","The Ridderzaal is the main building of the 13th century Binnenhof in The Hague, Netherlands. It is used for the state opening of Parliament on Prinsjesdag, when the Dutch monarch drives to Parliament in the Golden Coach and delivers the speech from the throne. It is also used for official royal receptions, and interparliamentary conferences.")
  
var infowindow = new google.maps.InfoWindow({maxWidth: 300});
  
  function geocodeLatLng(location,title,body) {
    var geocoder = new google.maps.Geocoder;
    var input = location;
    var latlngStr = input.split(',', 2);
    var latlng = {lat: parseFloat(latlngStr[0]), lng: parseFloat(latlngStr[1])};
    geocoder.geocode({'location': latlng}, function(results, status) {
      if (status === google.maps.GeocoderStatus.OK) {
        if (results[1]) {
          var marker = new google.maps.Marker({
            position: latlng,
            map: map
          });

          marker.addListener('click', function() {
            infowindow.setContent("<h3>" + title + "</h3>" + "<p>" + body + "</p>");
            infowindow.open(map, marker);
          });
          
        } else {
          window.alert('No results found');
        }
      } else {
        window.alert('Geocoder failed due to: ' + status);
      }
    });
  }
 
}
              
            
!
999px

Console