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

106
Views
Framer Motion scroll based on array push

I have a container that shows every card inside the cards array. The problem is that I can't seem to make the container scroll to the new card whenever the cards array is appended. What happens is that it does scroll, but only to the last card on the array, and not the new card.

<AnimatePresence>
  <div id="scrollContainer" scrollableX>
    {
      cards.length && cards.map(card =>
         // The Card component is a motion.div
         <Card/>
      )
    }     
  </div>
</AnimatePresence>

I have tried using scrollLeft on Javascript, but it only scrolls to the last card (the card before the newest card). The code was:

const container = document.getElementById("scrollContainer");
container.scrollLeft = container.scrollWidth;
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!