如何模拟触摸屏样式滚动?

时间:2012-01-06 21:14:49

标签: javascript html css touch

我想尝试模拟PC / Mac触摸屏设备上的触摸滚动手势。但是,我不想禁用滚轮。我想隐藏滚动条。

有没有人知道那些尝试这样做的演示/代码?

2 个答案:

答案 0 :(得分:0)

在某些浏览器 1 上,隐藏主滚动条是不可能的。但是,一般方法是:

html {
    overflow: hidden;
}

Demohere's a demo with the scrollwheel handled.


1 即IE8及更低版本。

http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel

答案 1 :(得分:0)

在基于 Webkit 的浏览器(例如 Chrome)中,您可以使用 ::-webkit-scrollbar

::-webkit-scrollbar {
  display: none;
}

在 Firefox 中,您可以使用 scrollbar-width:

* {
  scrollbar-width: none;
}