Preserve mouse position relative to the element