开发者

jQuery: The scrollbar sticks when i click it, causing it to scroll when my mouse isn't down. (with jsfiddle example)

http://jsfiddle.net/nicktheandroid/7raYa/9/

My script allows me to scroll the page like a PDF, allowing you to grab the page and drag down or up. My problem, is that when i use the scrollbar, then mouseup from the scroll bar, the scrollbar will st开发者_JS百科ick and scroll with my mouse up and down, even though my mouse is up. So when clicking on the scrollbar, its like i never moused up. how do I fix this?

THANKS!


I believe the scrollbar is part of the page, so when you click it, it makes your script believe the mouse is down - you'll notice that after you mouseup from clicking on the scrollbar that the page continues to move up and down until you click. Try to grab the coordinates of the mouse on mouse down, and make sure that the click occurred inside of the page (minus the scrollbar)

Edit: I was correct - here is the updated jsFiddle with it working: http://jsfiddle.net/xDtVL/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜