Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /Init the map.
  2.   map = DG.map('map', {
  3.     center: [54.98, 73.385],
  4.     zoom: 14,
  5.     fullscreenControl: false,
  6.     zoomControl: false,
  7.     doubleClickZoom: false
  8.   });
  9.  
  10. //Get all coordinates and names of locations and render them on the map.
  11.   $.getJSON("http://api.lara.dev/locations/", function(data) {
  12.     $.each(data, function(key, val) {
  13.       var geo = val.coordinates,
  14.         name = val.name,
  15.         id = val.id;
  16.       geo = geo.replace(/[\[\]]/g, '').split(',');
  17.       var marker = DG.marker(geo, {
  18.       }).addTo(map).bindPopup(name);
  19.       marker.on('click', function() {
  20.         window.location.href = "http://lara.dev/#/locations/" + id;
  21.       });
  22.     });
  23.   });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement