Dimi
Dimi

Reputation: 1

MapBox pop-up descriptions on markers not showing when clicking

I've integrated a MapBox map with marker clustering. For some reason the descriptions/titles will not show when you click on the marker. Any idea why this is happening or how to fix it?

The page: https://vpnarea.com/front/member/signuptest My MapBox code:

<script>
L.mapbox.accessToken = 'pk.xxxxxxxxxxxxxxxxxxxxxxx';



  var markers = L.markerClusterGroup();

  $.getJSON("https://vpnarea.com/data2.geojson-copy", function(data) {
    var geojson = L.geoJson(data, {
      onEachFeature: function (feature, layer) {

        layer.setIcon(L.mapbox.marker.icon({'marker-color': 'f5c200','marker-size': 'small'}));
      }
    });

    markers.addLayer(geojson);


    // CONSTRUCT THE MAP
    var map = L.mapbox.map('map1', 'vpnarea.m9b2pf4n') .setView([60,    -55], 3);
    markers.addTo(map);
  });




</script>

Upvotes: 0

Views: 261

Answers (1)

tmcw
tmcw

Reputation: 11882

You'll need to bind popups in order for them to appear: Mapbox.js's L.mapbox.featureLayer does this by default, but you're using L.geoJson, which does not. So you'll need to check out the Leaflet documentation for .bindPopup and use it.

Upvotes: 1

Related Questions