1.0.4 • Published 8 years ago
googlemap v1.0.4
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;
}
});