开发者

Javascript Contents scroller

I would like to create a PdfReader like text scrolle开发者_开发知识库r 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜