diff options
author | Jonas Smedegaard <dr@jones.dk> | 2018-01-05 01:03:58 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2018-01-05 01:20:40 +0100 |
commit | 5471216cac01d8d4a605ae890d066c9a7589bd55 (patch) | |
tree | db12870115f077b49c1dc30763ec8d8226e0994c /src/js/app | |
parent | bd2452f7524f1639d62597340e3a28ebf009f998 (diff) |
Add tooltip (when supported).
Diffstat (limited to 'src/js/app')
-rw-r--r-- | src/js/app/places.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/js/app/places.js b/src/js/app/places.js index 9b915cb..5ed04d0 100644 --- a/src/js/app/places.js +++ b/src/js/app/places.js @@ -2,7 +2,20 @@ define(['leaflet'], function(L) { // GeoJSON feature grouping function returnMarker(feature, latlng) { - return L.marker(latlng); + var marker = new L.marker( + latlng, + { opacity: 0.01 }); + // bindTooltip was introduced in LeafletJS 1.0. + try { + marker.bindTooltip( + feature.properties.name, + {permanent: true }); + } catch (e) { + if (console) { + console.warn('tooltip skipped (using an old Leaflet?)'); + } + }; + return marker; }; var place = L.geoJson([], { |