![](/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.