【问题标题】:Hide the vertical scroll bar while continuing to scroll继续滚动时隐藏垂直滚动条
【发布时间】:2021-11-09 12:46:15
【问题描述】:

我通过在 CSS 下面添加来隐藏垂直滚动条

overflow: hidden;

然后继续享受滚动而不显示滚动条,我输入以下代码:

overflow-y: scroll;
scroll-snap-type: y mandatory;

当然,滚动条再次出现并且滚动起作用。

我想隐藏滚动条,但我不能。我尝试了很多技巧都没有成功。

谢谢你启发我。

【问题讨论】:

    标签: css scroll scrollbar hidden


    【解决方案1】:

    使用::-webkit-scrollbar

    ::-webkit-scrollbar {
      opacity: 0;
      width: 0;
      display: none;
      background-color: transparent;
    }
    .div1 {
      height: 200vh;
      background-color: green;
    }
    .div2 {
      height: 100px;
      background-color: red;
    }
    <div class="div1">
      scroll me
    </div>
    <div class="div2"></div>

    【讨论】:

      猜你喜欢
      • 2013-10-26
      • 1970-01-01
      • 1970-01-01
      • 2013-02-12
      • 2019-04-23
      • 2020-10-18
      • 2018-08-17
      • 2017-02-08
      • 1970-01-01
      相关资源
      最近更新 更多