Perhaps the logic to move the arrow would be better off in its own function?

If I re-size the browser window / change orientation, then pointer position doesn't get updated. Maybe this could be refactored a little and called also when the browser window finishes resizing. Thoughts?