extensions/amp-carousel/0.1/slidescroll.js
/**
   * Updates to the right state of the new index on scroll.
   * @param {number} currentScrollLeft scrollLeft value of the slides container.
   */
Updates to the right state of the new index on scroll.
@param {number} currentScrollLeft scrollLeft value of the slides container.
Updates to the right state of the new index on scroll . @param { number } currentScrollLeft scrollLeft value of the slides container .
updateOnScroll_(currentScrollLeft) {
    this.snappingInProgress_ = true;
    const newIndex = this.getNextSlideIndex_(currentScrollLeft);
    this.vsync_.mutate(() => {
      if (this.isIos_) {
        this.slidesContainer_.classList.add('i-amphtml-no-scroll');
      }
      this.showSlideAndTriggerAction_(newIndex);
      this.vsync_.mutate(() => {
        if (this.isIos_) {
          this.slidesContainer_.classList.remove('i-amphtml-no-scroll');
        }
        this.snappingInProgress_ = false;
      });
    });
  }
updateOnScroll_ ( currentScrollLeft ) { this . snappingInProgress_ = true ; const newIndex = this . getNextSlideIndex_ ( currentScrollLeft ) ; this . vsync_ . mutate ( ( ) => { if ( this . isIos_ ) { this . slidesContainer_ . classList . add ( 'i-amphtml-no-scroll' ) ; } this . showSlideAndTriggerAction_ ( newIndex ) ; this . vsync_ . mutate ( ( ) => { if ( this . isIos_ ) { this . slidesContainer_ . classList . remove ( 'i-amphtml-no-scroll' ) ; } this . snappingInProgress_ = false ; } ) ; } ) ; }
Updates to the right state of the new index on scroll.
Updates to the right state of the new index on scroll .
//TODO (camelburrito): Identify more platforms that require // i-amphtml-no-scroll. // Make the container non scrollable to stop scroll events. // Scroll to new slide and update scrollLeft to the correct slide. // Make the container scrollable again to enable user swiping.