Accepted answer

See my snippet - that‘s what I understood. You need to use JavaScript event and classes since CSS can‘t change state.

var svg ="svg");

var path = d3.geoPath();

d3.json("", function(error, us) {
  if (error) throw error;

    .attr("class", "counties")
    .data(topojson.feature(us, us.objects.counties).features)
    .attr("d", path);

  // the following block is new, adding JS events
  let hoverEnabled = false;
  svg.on('mousedown', x => hoverEnabled = true)
    .on('mouseup', x => hoverEnabled = false)
  svg.selectAll('.counties path').on('mouseover', function() {
    if (hoverEnabled) {
     .attr("class", "county-borders")
    .attr("d", path(topojson.mesh(us, us.objects.counties, function(a, b) { return a !== b; })));
/* paths with class "hovered" need to be selected here, too */
.counties .hovered, .counties :hover {
  fill: red;

.county-borders {
  fill: none;
  stroke: #fff;
  stroke-width: 0.5px;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
<!DOCTYPE html>
<svg width="960" height="600"></svg>
<script src=""></script>
<script src=""></script>

Related Query