adding custom hover color to the map from the admin settings
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 13 Nov 2018 15:09:49 +0000 (10:09 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 13 Nov 2018 15:09:49 +0000 (10:09 -0500)
views/front/map/display.html

index 65a3197..adc56ce 100644 (file)
                 };
             }
 
-            // 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;
                     }).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);