Fix document scrolling bug

Changed references to pageX to clientX, which are only different when the document is scrolled.