Use boundingClientRect instead of offsetTop/Height.