This example demonstrates how to compute a suitable translate and scale to zoom to the bounding box of a particular feature. Click on any state to zoom in; click on the focused state or the background to zoom out.
This variant uses transform transitions to change the viewport. A slightly better approach, and one that can also allow free panning and zooming with the mouse if desired, is to use zoom transitions.
Changed /mbostock/raw/4090846/us.json to a local referenece
https://d3js.org/d3.v3.min.js
https://d3js.org/topojson.v1.min.js