![](/img/trans.png)
[英]jQuery or Javascript - how to disable window scroll without overflow:hidden;
[英]Javascript/Ionic3 Overflow:hidden disable scroll in Firefox
我有无法删除Firefox Quantum滚动条的问题。 哦,Chrome就像这css一样具有魅力:
div::-webkit-scrollbar {
border:none;
width:0;
background: rgba(0,0,0,0);
display: none;
overflow-x: hidden;
overflow-y: hidden;
}
div::-webkit-scrollbar-track {
border:none;
width:0;
background: rgba(0,0,0,0);
display: none;
overflow-x: hidden;
overflow-y: hidden;
}
div::-webkit-scrollbar-thumb {
border:none;
width:0;
background: rgba(0,0,0,0);
display: none;
overflow-x: hidden;
overflow-y: hidden;
}
我也尝试使用jQuery删除它,并将其直接添加到body标记中,例如style="overflow: hidden;"
那没有用。 看来我无法摆脱它们。 如何删除它们?
编辑:
加上overflow: hidden;
到.scroll-content{}
它删除了滚动条,但我无法在Firefox上滚动。 如何启用带有溢出的滚动
你可以做这样的事情。
<style>
#container{
height: 500px;
width: 200px;
background-color: #ccc;
overflow: hidden;
}
#container-inner{
width: calc(100% + 17px);
height: 100%;
overflow: scroll;
overflow-x: hidden;
}
.content{
width: 100%;
height: 300px;
}
.one{
background-color: red;
}
.two{
background-color: green;
}
.three{
background-color: yellow;
}
</style>
<div>
<div id="container">
<div id="container-inner">
<div class="content one">
</div>
<div class="content two">
</div>
<div class="content three">
</div>
</div>
</div>
</div>
我会创建一个小提琴,但是https://jsfiddle.net/现在不可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.