How to use the mapbox.js.Control function in mapbox

To help you get started, we’ve selected a few mapbox examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openseattle / sewardparkstories.org / lib / map.js View on Github external
map.setZoom(state.map.zoom)
    map.setView(state.map.center)
  })

  var location = L.marker([47, -122], {
    icon: L.mapbox.marker.icon({
      'marker-size': 'small',
      'marker-color': '#fa0'
    })
  }).addTo(map)

  movement.on('data', function (data) {
    location.setLatLng(new L.LatLng(data.coords.latitude, data.coords.longitude))
  })

  new L.Control.Zoom({ position: 'topright' }).addTo(map)

  function attributionPosition (position) {
    new L.control.attribution({ position: state.attribution })
      .setPrefix('')
      .addAttribution('<a href="https://www.mapbox.com/about/maps/">© Mapbox</a>')
      .addAttribution('<a href="https://www.openstreetmap.org/about">© OpenStreetMap</a>')
      .addAttribution('<a href="https://www.mapbox.com/map-feedback/">Improve this map</a>')
      .addTo(map)
  }

  var markerLayer = L.mapbox.featureLayer().addTo(map)
  markerLayer.setGeoJSON(state.locations)

  var clicked = false
  markerLayer.on('mouseover', function (e) {
    e.layer.openPopup()