views:

16

answers:

2

I would like to create a PdfReader like text scroller in Javascript. I mean as I click in PDF Document, a handpointer will be shown and by Moving mouse in any direction the document will be scrolled in that direction if possible.

I want to implement this function on a DIV Contents.

Thanks.

A: 

You might be able to do that combining the events onMouseDown and onMouseMove. So as a users clicks the content of the DIV, you safe the position of the content in the DIV. When the user moves the mouse, you set the position within the DIV. Using "overflow: hidden" for the content, you should get something very close to a PDF viewer behaviour.

Kau-Boy
Thanks for the answer, the only problem is that when I use an Image as DIV Contents, it does not work!
Can you provide us an example of what you have already done? That would make it easier to see the issues and find a solution.
Kau-Boy
A: 

For the scrolling logic, you can get inspired at the scriptaculous library: a Draggable includes a way to scroll, see dragdrop.js.

giraff