Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

78
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda