Bergen88 Bergen88 - 6 months ago 6
Javascript Question

Polygon highlighting with Mapbox or Leaflet

I am trying to replicate polygon highlighting on mouseover event in mapbox.js or leaflet.js similar to the example below:

How does this work?


Using Leaflet, you simply have to define a function to set the style of the polygon on mouseover event. For example:

polygonLayer.on('mouseover', function (this) {
        fillOpacity: 0,
        color: 'black'