UNPKG

googlemap

Version:

A simple module for displaying Google Maps

47 lines (35 loc) 848 B
# 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): ```json [ { "latitude": 55.944083, "longitude": -3.161833, "title": "Arthurs Seat" }, { "latitude": 51.507752, "longitude": -0.12793, "title": "Nelsons Column" } ] ``` ```html <div id="map" data-markers='{{ markers }}'></div> ``` Simple example: ```javascript var mapCanvas = document.getElementById('map'); new GoogleMap(mapCanvas); ``` Marker click event callbacks: ```javascript var mapCanvas = document.getElementById('map'); new GoogleMap(mapCanvas, { markerClickCallback: function (marker, data) { return window.location = 'http://www.google.co.uk?q=' + data.title; } }); ```