js/GridColumnCarousel.js
//first page i index 0, and the nth page is index n-1.
first page i index 0, and the nth page is index n-1.
first page i index 0 and the nth page is index n - 1 .
function slideToPage(pageNumber) {
      if(pageNumber < 0) {
        pageNumber = pagesCount - 1;
      } else if(pageNumber >= pagesCount) {
        pageNumber = 0;
      }
      if(displayPageIndicators) {
        pageIndicatorsContainerElem.getElementsByClassName('active')[0].classList.remove('active');
        pageIndicatorsContainerElem.getElementsByClassName('grid-column-carousel__page-indicator')[pageNumber].classList.add('active');
      }     
      currentPage = pageNumber;
      if(autoplay) {
        setAutomaticSlideChange();
      }
      if(pageNumber === 0) {
        setX(0);
      } else {
        setX(pageNumber * slideWidth * -1);
      }      
    }
function slideToPage ( pageNumber ) { if ( pageNumber < 0 ) { pageNumber = pagesCount - 1 ; } else if ( pageNumber >= pagesCount ) { pageNumber = 0 ; } if ( displayPageIndicators ) { pageIndicatorsContainerElem . getElementsByClassName ( 'active' ) [ 0 ] . classList . remove ( 'active' ) ; pageIndicatorsContainerElem . getElementsByClassName ( 'grid-column-carousel__page-indicator' ) [ pageNumber ] . classList . add ( 'active' ) ; } currentPage = pageNumber ; if ( autoplay ) { setAutomaticSlideChange ( ) ; } if ( pageNumber === 0 ) { setX ( 0 ) ; } else { setX ( pageNumber * slideWidth * - 1 ) ; } }
first page i index 0, and the nth page is index n-1.
first page i index 0 and the nth page is index n - 1 .
//ensure that pageNumber is not out of bounds //toggle active class on page indicators //if autoplay is set, start automatic slide change. This will cancel any previously //set waiting slide change. //if slide to the first page, just set translateX to 0.