From 67917aa52691959b61821c0fdfac281bc1c3a98b Mon Sep 17 00:00:00 2001 From: Kobe Mertens Date: Thu, 14 Feb 2019 12:30:31 +0100 Subject: [PATCH] fixed #23 --- src/js/map.js | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/js/map.js b/src/js/map.js index 71ce72f..7092b93 100644 --- a/src/js/map.js +++ b/src/js/map.js @@ -26,15 +26,22 @@ $(document).ready(function() { } function pointToLayer(feature, latlng) { - if (feature.properties) { - if (feature.properties.holidays && christmasHoliday) { - return L.marker(latlng, {icon:christmasIcon}); - } - if (!feature.properties.hours.saturday && !feature.properties.hours.sunday) { - return L.marker(latlng, {icon:blueIcon}); - } + var marker = L.marker(latlng, { icon: redIcon, riseOnHover: true }); + if (feature.properties) { + if (feature.properties.holidays && christmasHoliday) { + var marker = L.marker(latlng, { icon: christmasIcon, riseOnHover: true }); } - return L.marker(latlng, {icon: redIcon}); + if (!feature.properties.hours.saturday && !feature.properties.hours.sunday) { + var marker = L.marker(latlng, { icon: blueIcon, riseOnHover: true }); + } + } + marker.on('mouseover', function (ev) { + marker.openPopup(); + }); + marker.on('mouseout', function (ev) { + marker.closePopup(); + }); + return marker } var map = L.map('map').setView([51.0475378, 3.7261835], 13);