Sha256: 7a83d0eb25d01f176273e402ee0973c43ff6bbaf710f629ce58f3e2103ae2f4f

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

<div id='google-map'></div>

<script type='text/javascript'>
  var jekyllMaps = (function () {
    'use strict';

    return {
      loadScript: function (url) {
        var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = url;
        document.body.appendChild(script);
      },
      initialize: function () {
        this.options = {
          center: new google.maps.LatLng(0, 0),
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          zoom: 3
        }
        this.map = new google.maps.Map(document.getElementById('google-map'), this.options);
        this.showMarkers({{ locations }});
      },
      showMarkers: function (locations) {
        var map = this.map,
            bounds = new google.maps.LatLngBounds(),
            markers = locations.map(function (location) {
              var position = new google.maps.LatLng(location.latitude, location.longitude);
              var marker = new google.maps.Marker({
                position: position,
                title:    location.title,
                url:      location.url,
                map:      map
              });

              marker.addListener('click', function () {
                window.location.href = this.url
              });
              bounds.extend(position);

              return marker;
            });

        new MarkerClusterer(map, markers, {
          gridSize: 25,
          imagePath: 'https://raw.githubusercontent.com/googlemaps/js-marker-clusterer/gh-pages/images/m'
        });
        map.fitBounds(bounds);
      },
    };
  }());
</script>
<script src='https://googlemaps.github.io/js-marker-clusterer/src/markerclusterer.js'></script>
<script src='https://maps.googleapis.com/maps/api/js?callback=jekyllMaps.initialize'></script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-maps-1.0.2 lib/jekyll-maps/google_map.html