From 5471216cac01d8d4a605ae890d066c9a7589bd55 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 5 Jan 2018 01:03:58 +0100 Subject: Add tooltip (when supported). --- src/js/app/places.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/js/app') 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([], { -- cgit v1.2.3