donde.js
Simplifies the basic use of Google Maps.
- Embed a map.
- Center it to the user's location.
- Add markers.
- Filter the markers.
Installation
Install the library by running: bower install donde.js --save.
Usage
Once you have included the script in your markup, you can run:
new Donde({
container: 'js-map'
, zoom: 15
, defaultPosition: {
latitude: -34.8937720817105
, longitude: -56.1659574508667
}
, markers: [
{
icon: 'img/marker-1.png'
, type: 'A'
, position: {
latitude: -34.790626820565095
, longitude: -56.352119473107685,
}
}
, {
icon: 'img/marker-2.png'
, type: 'B'
, position: {
latitude: -34.79742147359551
, longitude: -56.24659744591109
}
}
]
});Options
containeris the id of the DOM element where the map will be rendered.zoomis the map's default zoom value.defaultPositionis where the map will be centered and the user's marker positioned in case geolocation is unavailable.- Markers
iconis the path to the markers image.typeis used for the filtering of markers.positionis the geolocation where the marker should be placed.