您当前的位置: 首页 >  Java

命运之手

暂无认证

  • 3浏览

    0关注

    747博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【Javascript】【jQuery】jQuery实现回到顶部功能

命运之手 发布时间:2019-04-23 22:37:07 ,浏览量:3


    
        
TOP
* { margin: 0px; padding: 0px; } #content { width: 100%; height: 4000px; background: linear-gradient(yellowgreen, orange, yellowgreen); } #top-scroll { width: 80px; height: 80px; background: dodgerblue; position: fixed; right: 10px; bottom: 10px; display: grid; justify-items: center; align-items: center; -webkit-user-select: none; cursor: pointer; color: white; } #top-scroll:hover { border: white 1px solid; } #top-scroll:active { border: white 2px solid; } $(() => { $("#top-scroll").click(() => { let sy = $("html").scrollTop(); let dy = sy / 200 * 10; //500ms内滑动到顶端,每个50ms滑动一次 let intervalId = setInterval(() => { sy = sy - dy; if (sy
关注
打赏
1654938663
查看更多评论
0.0362s