1👍
✅
The issue was that getBoundingClientRect was taking into account the margin of my overall content wrapper. This wrapper’s margin is changed when the page is resized to better fit the contents and thus getBoundingClientRect would also change it’s output. I’m not sure why it took into account just this one div’s margin, but I just subtracted the margin from the top and left values to fix my issue.
Source:stackexchange.com