隐藏滚动条,但保持滚动的原生感觉

发布于 2024-11-19 06:13:21 字数 485 浏览 1 评论 0原文

I've searched for an answer to this question and came across
hide scrollbar while still able to scroll with mouse/keyboard but the jQuery plugin doesn't quite do what I'd like to do. For one, the scrolling feels a bit sloppy and uncontrollable.
The reason why I need this is simple: my page gets a little longer when you expand some items and the scrollbar appears out of the side and makes everything move to the left. I'd like to have a way to avoid this, by either being able to keep the scrollbar visible at all times or hiding it completely but still keep the native ability to scroll.

Here's an example of what I mean: http://screencast.com/t/Roi3HJtHyH when the long entry is clicked the content moves to the left, and this effect looks a little ugly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

飘过的浮云 2024-11-26 06:13:21

只是为了完整起见,为了回答您的问题,这里是没有滚动条的可滚动页面

请注意,这不是首选,而且我也会强制滚动条,因为 Lobello 已经回答了。

Just for completeness sake, to answer your question, here is the scrollable page without scrollbar.

Note that this is not preferred, and I would also force the scrollbar as Lobello already answered.

‖放下 2024-11-26 06:13:21

这是标准的浏览器行为。

取消滚动条会降低用户友好性。


您可以使用 css 将滚动条设置为始终可见。

CSS:

body {
    overflow-y: scroll;
}

That is standard browser behavior.

Taking away scrollbar reduces user-friendliness.


You can set scrollbar to stay visible all the time with css.

CSS:

body {
    overflow-y: scroll;
}
墨离汐 2024-11-26 06:13:21

如果你确实想禁用滚动(在框架集中,滚动最糟糕的地方),那么使用scrolling=no。

If you really want to disable the scrolling (In a frameset, the worst possible place for scrolling) then use scrolling=no.

木落 2024-11-26 06:13:21

这对我有用:

    body{
        overflow:hidden;
    }

This works for me:

    body{
        overflow:hidden;
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文