开发者

How do I hide (but not disable) scrollbars on iPad while scrolling?

I am working with the iPad (mobile safari):

Question: Does anyone know how to hide the scrollb开发者_如何学Pythonars on iPad?

I have looked already looked into webkit scrollbar styling using ::-webkit-scrollbar... This does not work for the main windows scrollbars.

Scenario: I have an repeating image inside of a div that is over 10,000px by 10,000px. I want the user to be able to swipe the screen to move around over this huge div, which is essentially one big image, WITHOUT the scrollbars showing up.

So I need the functionality of the scrollbars, I just need them to be hidden.

Suggestions?

Thanks for your help! -slwd


You might be able to use the TouchScroll library: http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/

Otherwise, what I would do is set overflow: hidden on your div and then use JavaScript to implement the scrolling. This will require listening for touchstart, touchmove, and touchend events, and moving the x/y position of your image accordingly. If you need frictional slowing (similar to what's built into scrolling views on mobile Safari) you can implement that as well. Keep track of the dx/dy between touchmove events, use that as a starting velocity for when you receive a touchend, then use setInterval as a timer to apply the friction until some minimum threshold at which you stop the animation.


This is sort of a hack, but: Make your UIWebView about 10px taller and wider than the screen.

(Inspired by someone asking the opposite question.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜