Simple Maps
demo
Example
<style>
#map{
width: 500px;
height: 300px;
}
</style>
<div id="map"></div>
<script src="../dist/maps.js"></script>
<script>
var start = function(){
var options = {
zoom : 17
}
var myMap = new Map('map', options),
myMarkers = []
myMarkers[0] = new Marker({
map: myMap,
position: { lat: -6.2009877,lng: 106.8391089 }
})
myMarkers[0].drop()
}
</script>
Installation
add this on you head
<meta id="MAPS_API_KEY" content="apikey123">
<meta id="MAPS_API_URL" content="https://maps.googleapis.com/maps/api/js">
<meta id="MAPS_CALLBACK" content="start">
- MAPS_API_KEY : you can get from google developer (required)
- MAPS_API_URL : google maps api URL (optional)
- MAPS_CALLBACK : first function that will called, after maps is loaded
Also add this on bottom of body
<script src="../dist/maps.js"></script>
Map API
Construct a Map
var myMap = new Map('map', options)
Set Center
myMap.setCenter({ lat: -6.2009877,lng: 106.8391089 });
Set Zoom
myMap.setZoom(10);
Marker API
Create a Marker
var myMarker = new Marker({
map: myMap,
position: { lat: -6.2009877,lng: 106.8391089 }
})
Draw Marker to Map
myMarker.draw()
Drop
myMarker.drop()
Jump
myMarker.jump()
Jump Once
myMarker.jumpOnce()
Remove
myMarker.remove()