You'll probably want to use a brush to do this in d3.js. You can see an example that I put together at which does something similar.

The relevant code is:

var brush = d3.svg.brush()
    .on("brush", display);

where display is a function that redraws data based on the current extent of brush. This way you don't need to try and hook your own handlers or even worry about resizing the highlighted region at all.

Related Query

More Query from same tag