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

178
Visualizações
Infinite autoplay slider React js

Rows Image

In the above picture, I want the rows to move to the left infinitely.

Below is the component code:

 <div id={id} className="row__posters">
          {movies.map((movie) => (
            <img
              key={movie.id}
              onClick={() => handleClick(movie)}
              className={`row__poster ${isLargeRow && "row__posterLarge"}`}
              src={`${base_url}${
                isLargeRow ? movie.poster_path : movie.backdrop_path
              }`}
              loading="lazy"
              alt={movie.name}
            />
          ))}
        </div>

And here is the css for the component code:

.row {
  color: white;
  margin-left: 20px;
}
.row__posters {
  display: flex;
  overflow-y: hidden;
  overflow-x: scroll;
  padding: 20px;
}
.row__posters::-webkit-scrollbar {
  display: none;
}

.row__poster {
  max-height: 100px;
  object-fit: contain;
  margin-right: 10px;
  transition: transform 450ms;
}
.row__poster:hover {
  transform: scale(1.08);
  opacity: 1;
}
.row__posterLarge {
  /* overflow-x: scroll; */
  max-height: 250px;
  /* width: calc(250px * 20); */
  animation: scroll 40% linear =infinite;
}
.row__posterLarge:hover {
  transform: scale(1.09);
  opacity: 1;
}
@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-250px * 10));
  }
}

I want the large row to have an infinite autoplay slider and the other rows shouldn't be affected. I tried (https://www.youtube.com/watch?v=3Z780EOzIQs) but nothing happened. Then I tried react-slick third party (https://react-slick.neostack.com/docs/example/pause-on-hover) and it only broke the rows, it turned them into one column(left-aligned).

Do you have any ideas on how to implement this feature?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use react-slick for that. If you want to make it infinite scroll. You have to change the settings object. Which you pass inside the Slider Component. Add these two inside the setting -

autoplay: true, autoplaySpeed: 2000,

to make it infinite scroll you can use -

infinite: true,

You should also mention how many slides to show.

slidesToShow: 3, slidesToScroll: 1,

Make sure those properties are these. And you have imported css file inside you component.

import "slick-carousel/slick/slick.css"; import "slick-carousel/slick/slick-theme.css";

about 4 years ago · Juan Pablo Isaza Relatório
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