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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                <a href="#" class="map-link" data-title="East Howe Steps">East Howe Steps</a>



<div id='EastHowe'></div>
              
            
!

CSS

              
                
              
            
!

JS

              
                // With map code
<script src='https://maps.googleapis.com/maps/api/js?key=AIzaSyA6a4KqgURMtbtNGWxf6snGj0VSZKGkUjY&sensor=false&extension=.js'></script> 
 
<script> 
    var markers = [];
    google.maps.event.addDomListener(window, 'load', init);
    var map;
    function init() {
        var mapOptions = {
            center: new google.maps.LatLng(47.639499,-122.324432),
            zoom: 14,
            zoomControl: true,
            zoomControlOptions: {
                style: google.maps.ZoomControlStyle.DEFAULT,
            },
            disableDoubleClickZoom: true,
            mapTypeControl: true,
            mapTypeControlOptions: {
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
            },
            scaleControl: true,
            scrollwheel: true,
            panControl: true,
            streetViewControl: true,
            draggable : true,
            overviewMapControl: true,
            overviewMapControlOptions: {
                opened: false,
            },
            mapTypeId: google.maps.MapTypeId.ROADMAP,
        }
        var mapElement = document.getElementById('EastHowe');
        var map = new google.maps.Map(mapElement, mapOptions);
        var locations = [
['East Howe Steps', 'undefined', 'undefined', 'undefined', 'undefined', 47.63659149999999, -122.32585899999998, 'https://mapbuildr.com/assets/img/markers/ellipse-black.png'],['Amazon Campus', 'undefined', 'undefined', 'undefined', 'undefined', 47.620173, -122.3362563, 'http://easthowesteps.com/images/map-az-small.png'],['Facebook HQ', 'undefined', 'undefined', 'undefined', 'undefined', 47.6288231, -122.3447786, 'http://easthowesteps.com/images/map-fb-small.png'],['Fred Hutch', 'undefined', 'undefined', 'undefined', 'undefined', 47.627267, -122.3336798, 'http://easthowesteps.com/images/map-fred-small.png']
        ];
        for (i = 0; i < locations.length; i++) {
			if (locations[i][1] =='undefined'){ description ='';} else { description = locations[i][1];}
			if (locations[i][2] =='undefined'){ telephone ='';} else { telephone = locations[i][2];}
			if (locations[i][3] =='undefined'){ email ='';} else { email = locations[i][3];}
           if (locations[i][4] =='undefined'){ web ='';} else { web = locations[i][4];}
           if (locations[i][7] =='undefined'){ markericon ='';} else { markericon = locations[i][7];}
            marker = new google.maps.Marker({
                icon: markericon,
                position: new google.maps.LatLng(locations[i][5], locations[i][6]),
                map: map,
                title: locations[i][0],
                desc: description,
                tel: telephone,
                email: email,
                web: web
            });
            markers.push(marker);
            link = '';
            bindInfoWindow(marker, map, locations[i][0], description, telephone, email, web, link);
        }
 function bindInfoWindow(marker, map, title, desc, telephone, email, web, link) {
      var infoWindowVisible = (function () {
              var currentlyVisible = false;
              return function (visible) {
                  if (visible !== undefined) {
                      currentlyVisible = visible;
                  }
                  return currentlyVisible;
               };
           }());
           iw = new google.maps.InfoWindow();
           google.maps.event.addListener(marker, 'click', function() {
               if (infoWindowVisible()) {
                   iw.close();
                   infoWindowVisible(false);
               } else {
                   var html= "<div style='color:#000;background-color:#fff;padding:5px;width:150px;'><h4>"+title+"</h4></div>";
                   iw = new google.maps.InfoWindow({content:html});
                   iw.open(map,marker);
                   infoWindowVisible(true);
               }
        });
        google.maps.event.addListener(iw, 'closeclick', function () {
            infoWindowVisible(false);
        });
 }
}
</script>




// With link code 
<script>
$(function) {

    // when link with class 'map-link' is clicked
    $('.map-link').on('click', function(e) {

    // prevent default link behaviour
    e.preventDefault();

    // get link data-title
    var titleToFind = $(this).data('title');

    // find map marker in markers array with the same title
    var markerToClick;
    for(var i = 0; i < markers.length; i++) {
        if(markers[i].title === titleToFind) {
          markerToClick = markers[i];
        }
    }

    // and click it using google events API
    new google.maps.event.trigger( markerToClick, 'click' );

  });
}

</script>
              
            
!
999px

Console