googlemap

1.0.4 • Public • Published

googlemap

Simple class which makes Google Maps out of HTML attributes.

Documentation

Sample data and HTML markup (latitude and longitude are required for each item):

[
    {
        "latitude": 55.944083,
        "longitude": -3.161833,
        "title": "Arthurs Seat"
    },
    {
        "latitude": 51.507752,
        "longitude": -0.12793,
        "title": "Nelsons Column"
    }
]
<div id="map" data-markers='{{ markers }}'></div>

Simple example:

var mapCanvas = document.getElementById('map');
 
new GoogleMap(mapCanvas);

Marker click event callbacks:

var mapCanvas = document.getElementById('map');
 
new GoogleMap(mapCanvas, {
    markerClickCallback: function (marker, data) {
        return window.location = 'http://www.google.co.uk?q=' + data.title;
    }
});

Package Sidebar

Install

npm i googlemap

Weekly Downloads

13

Version

1.0.4

License

WTFPL

Last publish

Collaborators

  • mikefrancis