zoukankan      html  css  js  c++  java
  • vue回到顶部

      backTop() {
          var top = document.body.scrollTop || document.documentElement.scrollTop;
          this.duration -= 3;
          this.duration = this.duration <= 0 ? 1 : this.duration;
          var speed = top / this.duration;
          document.documentElement.scrollTop -= speed;
          if (top > 0) {
            this.timer = setTimeout(() => {
              this.backTop();
            }, 16);
          } else {
            this.duration = 50;
            clearTimeout(this.timer);
            
          }
        }
    
  • 相关阅读:
    第二章例2-11
    第二章例2-10
    例2-11
    例2-9+2-10
    例2-7+例2-8
    例2-5+2-6
    例2-4
    例2-3
    例2-2
    例2-1
  • 原文地址:https://www.cnblogs.com/minty/p/11659924.html
Copyright © 2011-2022 走看看