Tyler1989
V2EX  ›  反馈

请问这个回到顶部的按钮可以取消吗?

  •  
  •   Tyler1989 · May 12, 2025 via Android · 1576 views
    This topic created in 391 days ago, the information mentioned may be changed or developed.


    移动端上下滑动比较方便,这个按钮有点碍眼
    3 replies    2025-05-22 09:46:38 +08:00
    geelaw
        1
    geelaw  
       May 12, 2025   ❤️ 2
    自定义 CSS 里设置

    button.scroll-top { display: none !important; }

    即可,另外这个按钮的实现挺古早的,jQuery 的 animate 滚动并不好看(缓动函数不好),推荐的做法是朴素的

    window.scroll(0, 0);

    并且在 html, body 上设置

    html, body { scroll-behavior: smooth; }
    @media (preferes-reduced-motion: reduce)
    {
    html, body { scroll-behavior: auto; }
    }

    来让浏览器决定如何滚动。
    geelaw
        2
    geelaw  
       May 12, 2025
    @geelaw #1 *prefers
    leadfast
        3
    leadfast  
       May 22, 2025
    自定义 CSS 设置开启有啥条件么,为什么我设置的不生效呢,这个按钮位置是越来越碍眼了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3115 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
    ♥ Do have faith in what you're doing.