如何制作一个像iPhone一样的浮动滚动条?
我正在创建一个手指友好的网络应用程序,但滚动条出现问题。理想情况下,我尝试重新创建 iPhone 的实现,其中滚动条仅在用户滚动内容时出现,并在滚动停止时消失。
有人有任何指点吗?
I'm creating a finger friendly web app and am having issues with the scrollbar. Ideally I'm trying to recreate the iPhone's implementation where the scrollbar only appears when the user scrolls the content and disappears when the scrolling stops.
Anyone got any pointers?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,我将从一些选项开始。 Azoff 有一个可滚动插件来帮助您入门。
最重要的是,从插件中删除它:
替换为:
在您的代码中,以插件页面为例:
这显示悬停时的滚动。您也可以设置
$("#overscroll").scroll()
事件来隐藏/显示,只需注意隐藏或显示将导致滚动本身,从而导致无限事件循环。您需要对回调进行一些检查,以确保它不是导致滚动事件的滚动条隐藏(它是在拖动时......所以鼠标向上并滚轮检查?)。First, I'd start with some of the options out there. Azoff has a scrollable plugin to get you started.
On top of that, remove this from the plug-in:
Replace with:
In your code, using the plugin page as an example:
This shows the scroll on hover. You could rig up the
$("#overscroll").scroll()
event to hide/show as well, just be ware that hiding or showing will cause a scroll itself, causing an infinite event loop. You'd need to set some checks on the callback to make sure it isn't a scrollbar hide that's causing the scroll event (It's on drag...so mouse up and scroll wheel check?).