Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
toggle classes via on multiple divs but only open one

Hello i wanna make a function what show an explanation to only one div all the time but it shows me any div can you help me please? Using VueJs

This is my function

showInfo() {
            const explanDiv = document.querySelectorAll('.explan-div')
            explanDiv.forEach(div  => {
                div.classList.toggle('opacity-scale')
                console.log('Hello')
            })
        },

and the HTML Code

<div v-if="!isPlayerVisible">
                <div class="grid grid-cols-1 auto-rows-[minmax(0,_150px)] w-11/12  mx-auto rounded-lg justify-center items-center">
                    <div class="hover-div relative text-white cursor-pointer mx-auto" v-for="(season, index) in seasons" v-bind:key="season.id">
                        <div v-on:click="playSong(index)" :style="{
                        backgroundImage: `url('/uploads/thumbnail/${season.thumbnail}')`,
                        width: '150px',
                        height: '100px',
                        backgroundSize: 'cover',
                        backgroundPosition: 'center',
                        borderRadius: '10px',
                        zIndex: '1',
                        }">
                        </div>
                            <div class="info-icon" v-on:click="showInfo">
                                <InfoIcon></InfoIcon>
                            </div>
                        <div class="explan-div opacity-scale">
                            <p class="text-center pt-2 text-[10px]">{{season.name}}</p>
                            <div class="p-2">
                                <p>Beschreibung:</p>
                                <p>{{season.description}}</p>
                            </div>
                        </div>
                    </div>
                </div>

I already tryed it with an Id binding but than it was totally destroyed and nothing worked do you know some efficent ways to do that? Thanks for any kind of help

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda