From db8e2efdbcde3b43ecb712f961f10d499bf2af5e Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Tue, 13 Nov 2018 10:09:49 -0500 Subject: [PATCH] adding custom hover color to the map from the admin settings --- views/front/map/display.html | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/views/front/map/display.html b/views/front/map/display.html index 65a3197..adc56ce 100644 --- a/views/front/map/display.html +++ b/views/front/map/display.html @@ -79,22 +79,6 @@ }; } - // Hover event handler - function highlightCounty(e) { - var layer = e.target; - layer.setStyle({ - weight: 3, - color: 'blue', - dashArray: '', - fillOpacity: 0.1 - }); - - if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) { - layer.bringToFront(); - } - - } - // Mouse out event handler function resetSelectedCounty(e) { var layer = e.target; @@ -130,12 +114,28 @@ }).addTo(countyMap); // Add actions to county layer + // countyLayer.on({ + // mouseover: highlightCounty, + // mouseout: resetSelectedCounty, + // click: zoomToCounty + // }); countyLayer.on({ - mouseover: highlightCounty, + mouseover: function(e){ + var layer = e.target; + layer.setStyle({ + weight: 3, + color: location.hover_color, + dashArray: '', + fillOpacity: 0.1 + }); + + if (!L.Browser.ie && !L.Browser.opera && !L.Browser.edge) { + layer.bringToFront(); + } + }, mouseout: resetSelectedCounty, click: zoomToCounty }); - // Get center of the county and add offsets var center = countyLayer.getBounds().getCenter(); var center = new L.LatLng(center.lat + countyData.latOffset, center.lng + countyData.lonOffset); -- 2.17.1