function cardsCarousel() {
  const slide = document.querySelectorAll(".circle");
  const transform = document.querySelectorAll(".card");

  let index = 1;
  let previousIndex = 1;

  slide.forEach(function (circle) {
    circle.addEventListener("click", function (e) {
      slide.forEach(function (circle) {
        if (circle.classList.contains("circle--active")) {
          previousIndex = circle.dataset.index;
        }
        circle.classList.remove("circle--active");
      });

      e.target.classList.add("circle--active");
      index = e.target.dataset.index;

      if (previousIndex <= index) {
        transform.forEach(function (card) {
          card.style.transform = `translateX(${-115 * index}%)`;
        });
      } else {
        transform.forEach(function (card) {
          console.log("nope");
          if (index == 0) {
            card.style.transform = `translateX(0%)`;
          }
          if (index == 1) {
            card.style.transform = `translateX(0%)`;
            card.style.transform = `translateX(-115%)`;
          }
        });
      }
    });
  });
}
// this function is for our works sliding
this function is for our works sliding
this function is for our works sliding
function cardsCarousel() {
  const slide = document.querySelectorAll(".circle");
  const transform = document.querySelectorAll(".card");
  let index = 1;
  let previousIndex = 1;
  slide.forEach(function (circle) {
    circle.addEventListener("click", function (e) {
      slide.forEach(function (circle) {
        if (circle.classList.contains("circle--active")) {
          previousIndex = circle.dataset.index;
        }
        circle.classList.remove("circle--active");
      });
      e.target.classList.add("circle--active");
      index = e.target.dataset.index;
      if (previousIndex <= index) {
        transform.forEach(function (card) {
          card.style.transform = `translateX(${-115 * index}%)`;
        });
      } else {
        transform.forEach(function (card) {
          console.log("nope");
          if (index == 0) {
            card.style.transform = `translateX(0%)`;
          }
          if (index == 1) {
            card.style.transform = `translateX(0%)`;
            card.style.transform = `translateX(-115%)`;
          }
        });
      }
    });
  });
}
function cardsCarousel ( ) { const slide = document . querySelectorAll ( ".circle" ) ; const transform = document . querySelectorAll ( ".card" ) ; let index = 1 ; let previousIndex = 1 ; slide . forEach ( function ( circle ) { circle . addEventListener ( "click" , function ( e ) { slide . forEach ( function ( circle ) { if ( circle . classList . contains ( "circle--active" ) ) { previousIndex = circle . dataset . index ; } circle . classList . remove ( "circle--active" ) ; } ) ; e . target . classList . add ( "circle--active" ) ; index = e . target . dataset . index ; if ( previousIndex <= index ) { transform . forEach ( function ( card ) { card . style . transform = ` ${ - 115 * index } ` ; } ) ; } else { transform . forEach ( function ( card ) { console . log ( "nope" ) ; if ( index == 0 ) { card . style . transform = ` ` ; } if ( index == 1 ) { card . style . transform = ` ` ; card . style . transform = ` ` ; } } ) ; } } ) ; } ) ; }
this function is for our works sliding
this function is for our works sliding