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

304
Views
cambiar el color del texto, la imagen y el fondo al pasar el mouse

También quiero cambiar el color de la imagen al pasar el mouse aplicando un filtro: brillo (10) pero está blanqueando todo el botón, por lo que no sé cómo cambiar el color del ícono.

botón flotante

por ejemplo puedes usar

 <div class="hello"><img src="https://i.ibb.co/HBbfCGF/play.png">bouton</div> <style> .hello {background-color: #eeeeee;color: #4171af;font-size: 20px} .hello:hover{background-color: #4171af; color: white;} </style>

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Agregue un filtro solo a la imagen:

 .hello { background-color: #eeeeee; color: #4171af; font-size: 20px } .hello:hover { background-color: #4171af; color: white; } .hello:hover img { filter: brightness(150%); }
 <div class="hello"><img src="https://i.ibb.co/HBbfCGF/play.png">bouton</div>

about 4 years ago · Juan Pablo Isaza Report

0

Le recomiendo que cree un segundo archivo de imagen y, al pasar el mouse, cambie el atributo src de la imagen usando JavaScript al archivo más brillante. También le permite ser más creativo que simplemente aumentar el valor de brillo.

Es una tarea sencilla, pero prefiero explicarla detalladamente. Parece que te has ocupado de los efectos de desplazamiento CSS básicos sin ningún problema, así que solo te mostraré el JavaScript.

Su HTML probablemente se vea así (agregué una class a la imagen y img el JavaScript):

 <div class="hello"> <img class="play" src="https://i.ibb.co/HBbfCGF/play.png"> <span>Button</span> </div> <script src="script.js"></script>

Ahora, desea cambiar el atributo src="" de la etiqueta <img> , al pasar el mouse sobre todo el <div> . Y cuando el mouse ya no se desplaza sobre el <div> , desea establecerlo en el valor predeterminado.

Deberá utilizar las funciones addEventListener() y setAttribute().

 let hello = document.querySelector('.hello'); hello.addEventListener('mouseover', function(){ let img = document.querySelector('.play'); img.setAttribute('img', 'path/to/the/second/file.png'); }); hello.addEventListener('mouseout', function(){ let img = document.querySelector('.play'); img.setAttribute('img', 'https://i.ibb.co/HBbfCGF/play.png'); });
about 4 years ago · Juan Pablo Isaza Report
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!