V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Tyler1989
V2EX  ›  反馈

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

  •  
  •   Tyler1989 · 25 天前 via Android · 732 次点击


    移动端上下滑动比较方便,这个按钮有点碍眼
    3 条回复    2025-05-22 09:46:38 +08:00
    geelaw
        1
    geelaw  
       25 天前   ❤️ 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  
       25 天前
    @geelaw #1 *prefers
    leadfast
        3
    leadfast  
       15 天前
    自定义 CSS 设置开启有啥条件么,为什么我设置的不生效呢,这个按钮位置是越来越碍眼了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5374 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 20ms · UTC 06:53 · PVG 14:53 · LAX 23:53 · JFK 02:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.