如何在 iPad 上滚动时隐藏(但不禁用)滚动条?
我正在使用 iPad(移动 safari):
问题: 有谁知道如何隐藏iPad上的滚动条吗?
我已经使用 ::-webkit-scrollbar 研究了 webkit 滚动条样式...这不适用于主窗口滚动条。
设想: 我在 div 内有一个重复图像,大小超过 10,000 像素 x 10,000 像素。我希望用户能够滑动屏幕在这个巨大的 div 上移动,这本质上是一个大图像,而不显示滚动条。
所以我需要滚动条的功能,我只需要隐藏它们。
建议?
感谢您的帮助! -slwd
I am working with the iPad (mobile safari):
Question:
Does anyone know how to hide the scrollbars 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您也许可以使用 TouchScroll 库: http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/
否则,我要做的就是设置
overflow:hidden
在你的div上,然后使用JavaScript来实现滚动。这将需要侦听 touchstart、touchmove 和 touchend 事件,并相应地移动图像的 x/y 位置。如果您需要摩擦减慢(类似于移动 Safari 上滚动视图中内置的内容),您也可以实现它。跟踪 touchmove 事件之间的 dx/dy,将其用作接收 touchend 时的起始速度,然后使用 setInterval 作为计时器来应用摩擦力,直到达到停止动画的最小阈值。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.这是一种 hack,但是:使你的 UIWebView 比屏幕高和宽约 10px。
(受到有人提出相反问题的启发。)
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.)