在文本框中点击和拖动滚动是否有简单的方法? [英] Is there an easy way to do click-and-drag scrolling in text frames?
问题描述
我有一个div与 overflow:auto
和一个滚动条,我想能够拖动内容滚动。我不需要能够选择文字。有没有办法做到这一点?一个jQuery插件会很好,否则原来的JavaScript会很好。
I have a div with overflow:auto
and a scroll bar, and I'd like to be able to drag the contents to scroll. I don't need to be able to select text. Is there an easy way to do this? A jQuery plugin would be good, otherwise plain old JavaScript would be fine.
似乎我没有足够清楚。有一个高度固定的div,我想滚动。而不是拿起滚动条,我想单击并拖动文本在相反的方向。喜欢在iPhone上喜欢在Photoshop中,当你按住空格和拖动。
It seems I haven't made myself clear enough. There's a div with a fixed height that I want to scroll. Instead of picking up the scroll bar, I want to click and drag inside the text in the opposite direction. Like on an iPhone. Like in Photoshop when you hold down space and drag.
-------------------
| | |
| | |
| |||
| | |
| <----------- click here and drag to scroll.
| | |
| | |
-------------------
推荐答案
这是拖曳和滚动div的一个很好的实现
Here is a nice implemenation of drag and scroll divs
http://plugins.jquery.com/project/Dragscrollable
下面是我的原始链接我贴了看来有人编辑我的答案。
below is my original link that I posted. Looks like someone edited my answer.
http: //hitconsultants.com/dragscroll_scrollsync/scrollpane.html
这篇关于在文本框中点击和拖动滚动是否有简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!