如何隐藏滚动条而不溢出:隐藏 [英] how to hide scrollbar without overflow: hidden

查看:215
本文介绍了如何隐藏滚动条而不溢出:隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就我而言,overflow:hidden确实隐藏了滚动条,但使它无法滚动(至少滚动在Firefox中不起作用).

So as far as I'm concerned, overflow:hidden does hide the scrollbar, but makes it impossible to scroll (at least scrolling doesn't work in Firefox).

我的主页上有一个滚动滑块-它会自动滚动以逐个降低全屏元素,然后返回第一个元素并重新开始.我认为它看起来确实不错,但是滚动条是可见的-我想使其不可见.溢出:隐藏时,滚动机制不起作用.

I have a scroller-slider on my homepage - it scrolls automaticaly to lower full-screen elements one by one and then comes back to the first element and starts over. It looks really nice in my opinion, but the scrollbar is visible - I would like to make it invisible. With overflow: hidden the scrolling mechanism doesn't work.

任何想法怎么做?

推荐答案

您可以使用CSS隐藏滚动条-将可滚动容器包装到另一个具有overflow:hidden且高度/宽度较小的容器中(取决于要隐藏的滚动体-垂直或水平的一个).如果您具有静态的容器/内容大小,这种方法会有所帮助.如果可以调整容器的大小或大小取决于内容,则必须使用JS解决方案来计算容器的大小.

You can hide scrollbar with CSS - wrap your scrollable container into another one with overflow:hidden and less height/width (depending on scroll you want to hide - vertical or horizontal one). This way helps if you have static container/content sizes. If container can be resized or size depends on content - you will have to use JS solution to calculate container size.

这篇关于如何隐藏滚动条而不溢出:隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆