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

76
Vistas
Apply style to images before they are loaded

Particularly I am interested in applying style for images and background images. The style is injected with a CSS class into the page from a chrome extension. I have no direct control over elements on the page but only through my js script which is injected into webpage when it is open. The class that is applied to every element before the page is loaded with DOMContentLoaded event listener is smth like that:

function insertClass(){
 //find all elements with img tag or background style
 //add style to those elements
}
document.addEventListener('DOMContentLoaded', insertClass})

Eventhough, according to the description of DOMContentLoaded the function should run before the element is loaded, I still have a visual of images without the style applied for a split second, meaning that style is applied after the image is rendered. Is there a way to apply style before the image is rendered?

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

0

maybe it is just a typo, but there is an extra } in document.addEventListener('DOMContentLoaded', insertClass}), after insertClass

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