Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
05-05-2007, 12:49 AM #1
- Join Date
- Sep 2005
- Thanked 0 Times in 0 Posts
Help me with grab-n-drag scrolling, "pdf style"
This should be fairly simple but I just can't get it right. I want to create a way of scrolling the page when the user clicks and drags somewhere, similar to how you navigate in most pdf apps. So, click, move cursor one px to the right, the site scrolls one pixel to the right, etc.
So as long as the mouse button is pressed down, I want the scroll position to be equal to: cursor position in relation to the entire document, minus the cursor position in relation to the viewport. Right? Well I can't make it work... I haven't quite understood the difference between screenX/Y, offsetX/Y, clientX/Y, and plain x/y, and they don't quite behave the way I expect them to. So, if anyone could explain what's what, what I might be doing wrong, or better yet, point me to a good free cross browser script that already does what I want (there should be one somewhere...?), I'd be grateful!