Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
Continuous Carousel Sliding Effect

I am trying to create a slide left and right effect with an onclick command button on dynamically loaded items using CSS and JS.

I have been able to make the buttons call a translate function but they only move left/right only once. since I have a lot of dynamically loaded items, I want the button to be able to translate the images left/right over and over again. Is there any way to do it? here is the link codepen

          <!--Category Images-->  
      <button id="button" class="btn" onclick="translateRight()">Prev</button>
        <div id="itemImages" class="d-flex container-fluid  CatImages " alt="store items"></div> 
        
        <button id="button" class="btn" onclick="translateLeft()">Next</button>
<style>
    .item {
      display: inline-flex;
      background-color: white;
      padding: 10px;
      margin: 0px 20px 0px 20px;
      text-align: center;
      transform: translate(-0%,0%);
    }
    
    .btn {  
      height: 80px;
      width: 100px;
      background-color: white;
      z-index: 99;
      margin: 6% 0% 0% 0%;
      box-shadow: 6px 7px 10px 2px #efefef;
      text-align: center;
      
    }</style><script>
    function translateLeft(){
      var translateLeft = document.getElementById("itemImages").style.transform = "translate(-20%,0%)"
    }
    
    function translateRight(){
      var translateRight = document.getElementById("itemImages").style.transform = "translate(20%,0%)"
    }
      </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!