javascript - 设置溢出-x :scroll and hide the horizontal scrollbar

标签 javascript html css

我希望能够水平滚动,但不显示滚动条。

我知道,在 Chrome 中它是:

::-webkit-scrollbar { 
    display: none; 
}

但是 Firefox 和 Internet Explorer 呢?有人给出了以下解决方案,但它似乎不适用于水平滚动条,它只适用于垂直滚动条。

#parent{
        height: 100%;
        width: 100%;
        overflow: hidden;
    }

#child{
    width: 100%;
    height: 100%;
    overflow-y: scroll;
    padding-right: 17px; 
}

有人可以帮助我吗?

最佳答案

对于 fire fox 只需使用此规则:

overflow: -moz-scrollbars-none;

IE:

-ms-overflow-style: none;

jsFiddle Demo (Test it on FF & IE)

关于javascript - 设置溢出-x :scroll and hide the horizontal scrollbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36051164/

相关文章:

javascript - 使用 jquery 更改链接样式和属性

php - 在 php 的 javascript 中获取 Checkbox[] 值

javascript - 使用 JavaScript 选择子 HTML 元素

javascript - 如何检测 DOM 可拖动对象和 FabricJS 形状之间的碰撞

javascript - 在同一窗口(选项卡)中打开链接之前转到页面顶部。如何?

html - ASP.NET 表单输入 - 宽度意外行为(未扩展 100%)

javascript - 按多个字段过滤 Firebase

javascript - NodeJS、WebSockets(ws) 和 Openshift

javascript - 在 D3 中使用 HTML 作为标签

javascript - 使用 JsPlumb 库形成两个 div 的闭环