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

225
Vistas
There are different ways to handle resize events for your html document, is there a difference?

I saw that you can change styles with the CSS @media Rule, and you can also add window.addEventListener('resize', handleResize); in your javascript to change your document depending one its size.

Is there any difference and should you use one over the other? Or are they interchangeable?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you can do something in pure CSS, avoid using JavaScript.

I thought this was always true, but surprisingly from what I read, it is not always true especially when we speak about animations :

In most cases, the performance of CSS-based animations is almost the same as JavaScripted animations — in Firefox at least. Some JavaScript-based animation libraries, like GSAP and Velocity.JS, even claim that they are able to achieve better performance than native CSS transitions/animations

-- MDN

An other interesting link about CSS vs JS : SO : Should I avoid JS when possible and use CSS instead?

For classic uses (change mobile, tablet and desktop view), pure css is more efficient with media queries.

I'm hoping for new answers and get more informations about when prioritize JS than CSS.

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