extensions/amp-carousel/0.1/slidescroll.js
/**
   * Handles custom elastic scroll (snap points polyfill).
   * @param {number} currentScrollLeft scrollLeft value of the slides container.
   */
Handles custom elastic scroll (snap points polyfill).
@param {number} currentScrollLeft scrollLeft value of the slides container.
Handles custom elastic scroll ( snap points polyfill ) . @param { number } currentScrollLeft scrollLeft value of the slides container .
handleCustomElasticScroll_(currentScrollLeft) {
    const scrollWidth = this.slidesContainer_.scrollWidth;
    if (this.elasticScrollState_ == -1 &&
        currentScrollLeft >= this.previousScrollLeft_) {
      this.customSnap_(currentScrollLeft).then(() => {
        this.elasticScrollState_ = 0;
      });
    } else if (this.elasticScrollState_ == 1 &&
        currentScrollLeft <= this.previousScrollLeft_) {
      this.customSnap_(currentScrollLeft).then(() => {
        this.elasticScrollState_ = 0;
      });
    } else if (currentScrollLeft < 0) {
      this.elasticScrollState_ = -1;
    } else if ((currentScrollLeft + this.slideWidth_) > scrollWidth) {
      this.elasticScrollState_ = 1;
    } else {
      this.elasticScrollState_ = 0;
    }
  }
handleCustomElasticScroll_ ( currentScrollLeft ) { const scrollWidth = this . slidesContainer_ . scrollWidth ; if ( this . elasticScrollState_ == - 1 && currentScrollLeft >= this . previousScrollLeft_ ) { this . customSnap_ ( currentScrollLeft ) . then ( ( ) => { this . elasticScrollState_ = 0 ; } ) ; } else if ( this . elasticScrollState_ == 1 && currentScrollLeft <= this . previousScrollLeft_ ) { this . customSnap_ ( currentScrollLeft ) . then ( ( ) => { this . elasticScrollState_ = 0 ; } ) ; } else if ( currentScrollLeft < 0 ) { this . elasticScrollState_ = - 1 ; } else if ( ( currentScrollLeft + this . slideWidth_ ) > scrollWidth ) { this . elasticScrollState_ = 1 ; } else { this . elasticScrollState_ = 0 ; } }
Handles custom elastic scroll (snap points polyfill).
Handles custom elastic scroll ( snap points polyfill ) .
/*OK*/ // Elastic Scroll is reversing direction take control. // Elastic Scroll is reversing direction take control. // Direction = -1. // Direction = +1.