offsetX / offsetY
This example demonstrates how to precisely track the mouse position relative to an HTML element’s content area, accounting for borders, padding, and scroll offsets. A red circle with a smaller black center follows the cursor inside a child div, while the numeric offsets appear in an otherwise empty parent container. The code uses D3's event handling for `mousemove` and `getBoundingClientRect`, combined with `clientLeft`, `clientTop`, and `pageXOffset`/`pageYOffset`, to convert page coordinates into element-local coordinates. The visualization relies solely on D3.js version 2.7.4 and plain DOM styling.
AI-generated descriptionforked from <a href='http://bl.ocks.org/jasondavies/'>jasondavies</a>'s block: <a href='http://bl.ocks.org/jasondavies/1854606'>offsetX / offsetY</a>