pagelets/nodejitsu/anchor/base.js
function scroll(e) {
    var attr = e.element.attributes;

    if (!(attr || attr.href)) return;
    var target = $(attr.href.value).plain(0);

    if (!target) return;
    e.preventDefault();

    //
    // Store the current window top Y and difference.
    //
    this.y = document.body.scrollTop;
    this.target = target.offsetTop;
    this.direction = this.target > this.y ? 1 : -1;
    this.delta = Math.abs(this.y - this.target);

    //
    // Start the animation.
    //
    this.animated = setInterval(this.animate.bind(this), 10);
  }
function scroll(e) {
    var attr = e.element.attributes;

    if (!(attr || attr.href)) return;
    var target = $(attr.href.value).plain(0);

    if (!target) return;
    e.preventDefault();

    //
    // Store the current window top Y and difference.
    //
    this.y = document.body.scrollTop;
    this.target = target.offsetTop;
    this.direction = this.target > this.y ? 1 : -1;
    this.delta = Math.abs(this.y - this.target);

    //
    // Start the animation.
    //
    this.animated = setInterval(this.animate.bind(this), 10);
  }
function scroll ( e ) { var attr = e . element . attributes ; if ( ! ( attr || attr . href ) ) return ; var target = $ ( attr . href . value ) . plain ( 0 ) ; if ( ! target ) return ; e . preventDefault ( ) ; // // Store the current window top Y and difference. // this . y = document . body . scrollTop ; this . target = target . offsetTop ; this . direction = this . target > this . y ? 1 : - 1 ; this . delta = Math . abs ( this . y - this . target ) ; // // Start the animation. // this . animated = setInterval ( this . animate . bind ( this ) , 10 ) ; }
Scroll to the target of data-scroll.

@param {Event} e
@api private
Scroll to the target of data - scroll .