It is a very common practice to add hover effects on choropleth maps with d3.js. Here, the hovered regions has its opacity increased when all other regions are made more transparent. This example works with d3.js v4
and v6
path
. Two functions are triggered when the mouse hover/leave the country: mouseOver
and mouseLeave
opacity
and the stroke
of paths.