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

158
Views
¿Cómo configuro el tamaño máximo para la imagen en javascript (hover)?

Estoy usando este script:

 <html> <script> function hover(element) { element.setAttribute('src', 'http://dummyimage.com/100x100/eb00eb/fff'); } function unhover(element) { element.setAttribute('src', 'http://dummyimage.com/100x100/000/fff'); } </script> <img id="my-img" src="http://dummyimage.com/100x100/000/fff" onmouseover="hover(this);" onmouseout="unhover(this);" /> </html>

Cambiaré la fuente de la imagen pero quiero fijar el ancho a 120px. ¿Cómo puedo hacer esto?

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

0

Usando el atributo de estilo

element.style.width = '120px';

y también puede agregar mucho más estilo con el mismo atributo como relleno, margen, tamaño de fuente, etc.

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!