code: function (el, to, duration) {
          if (duration < 0) return;
          var difference = to - $(window).scrollTop();
          var perTick = difference / duration * 10;
  
          this.scrollToTimerCache = setTimeout(function() {
            if (!isNaN(parseInt(perTick, 10))) {
              window.scrollTo(0, $(window).scrollTop() + perTick);
              this.scrollTo(el, to, duration - 10);
            }
          }.bind(this), 10);
        }
docs: animated scrolling