Hi Rodrigo,
thank you for your quick response. I'm researching again because I think we're addressing a symptom here, but not the cause. Maybe I haven't fully understood it yet
What I mean is: why does everything work perfectly with position: static, but no longer with position:relative. As soon as I switch to relative, the mouse coordinates are no longer correct and the cursor is offset.
I don't always know the offset, so your solution doesn't work 100% for me.
Example: container has max-width:1000px, margin:auto.
Or content with variable height on top ( same problem with the Y coordinate offset).
https://jsfiddle.net/rsk257bd/1/