Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

108
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda