Bergen88 Bergen88 - 1 year ago 88
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'