Reputation: 177
I am trying to replicate polygon highlighting on mouseover event in mapbox.js or leaflet.js similar to the example below:
http://projects.nytimes.com/census/2010/explorer?view=raceethnicity&lat=40.6311&lng=-73.994&l=12
How does this work?
Upvotes: 0
Views: 1430
Reputation: 63
You can create a per-feature hover effect by using events and feature states of Mapbox GL JS.
Follow this link for implementation!
Upvotes: 0
Reputation: 1912
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) {
this.setStyle({
fillOpacity: 0,
color: 'black'
});
});
Upvotes: 1