【问题标题】:Javascript/Ionic3 Overflow:hidden disable scroll in FirefoxJavascript/Ionic3 溢出:在 Firefox 中隐藏禁用滚动
【发布时间】:2018-04-29 20:27:13
【问题描述】:

我的问题是我无法删除 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 上滚动。如何启用溢出滚动:隐藏;

【问题讨论】:

    标签: javascript jquery css firefox


    【解决方案1】:

    你可以这样做。

    <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/ 现在已关闭。

    【讨论】:

    • 宽度:计算(100% + 17px);努力隐藏滚动条。甚至不需要休息谢谢!
    猜你喜欢
    • 2013-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    相关资源
    最近更新 更多