From: Anthony Talarico Date: Tue, 13 Nov 2018 15:09:49 +0000 (-0500) Subject: adding custom hover color to the map from the admin settings X-Git-Tag: v1.0.0^2~24 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=db8e2efdbcde3b43ecb712f961f10d499bf2af5e;p=WP-Plugins%2Fglm-member-db-county-map.git adding custom hover color to the map from the admin settings --- 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);