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

375
Visualizações
React - When we mouseover an element, how to select multiple elements except the we hover over?

I am currently trying to replicate a function of the Netflix homepage:

We have several rows of movies. When we don't mouseover any movie, the movie images stay normal. But when we hover over a movie, the current image scales up and all the other ones in this row to get their opacity reduced. When we "onMouseOut" the row, everything gets back to normal

I am currently wondering how to implement that into an onMouseOver function. If anyone has an idea, that'd very helpful.

PS: I also use Swiper JS.

Thank you for your help.

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

0

The solution could be to add a class to that element during the onMouseOver event. This way you can easily select what elements you would like to stylize.
You could also add a class name to the container so that you could select all elements without selected class or without a hover. Please try the one below, it seems to be the simplest:

.container:hover > .item:not(:hover) { 
  opacity: 0.5;
}

Please see the codepen below:

https://codepen.io/damianbartosik/pen/JjrzrZd

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