Skip to content

Commit

Permalink
reordering popup binding (#31)
Browse files Browse the repository at this point in the history
As mentioned in the example on leaflet's homepage (https://leafletjs.com/SlavaUkraini/) the binding of the popup need to happen after the marker is added to the map
  • Loading branch information
ryangurn authored Apr 8, 2022
1 parent 0e6790f commit 5a97d05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resources/views/components/leaflet.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ class='{{ $attributes["class"] }}'
});
@endif
var marker = L.marker([{{$marker['lat'] ?? $marker[0]}}, {{$marker['long'] ?? $marker[1]}}]);
marker.addTo(mymap);
@if(isset($marker['info']))
marker.bindPopup(@json($marker['info']));
marker.bindPopup(@json($marker['info']));
@endif
marker.addTo(mymap);
@endforeach
@if($tileHost === 'mapbox')
Expand Down

0 comments on commit 5a97d05

Please sign in to comment.