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

108
Visualizações
HTML showing when page is loading before JS & CSS is being applied

I'm making a small project using API + SVG for map and I am using SVG by directly putting inside HTML under SVG tag but it seems like when the page is loading, pure HTML is displaying before my JAVASCRIPT or CSS is applied.

I have done some research and used a window.onload, load event listener and such but none seem to work when I actually deploy my website on netlify.

Any advice on how only show loading animation until javascript + CSS is fully applied to all HTML elements?

I am using a webpack + vanilla JS for my project. I will post my code before for my entry JS file

document.querySelector(".main").style.visibility = "hidden";
window.onload = () => {
    document.querySelector(".main").style.visibility = "visible";
    navList();
    regionHoverEvent();
    generateRippleEffect();
    document.querySelector(".main").style.visibility = "visible";
    document.querySelector(".koreaMap").style.visibility = "visible";
    document.querySelector(".navContainer").style.visibility = "visible";

    setInterval(() => {
        generateRippleEffect();
    }, 5000);

    setInterval(() => {
        document.querySelectorAll("i").forEach((item) =>
            item.addEventListener("animationend", () => {
                item.classList.remove("enterCircles");
                item.classList.add("exitCircles");
                setTimeout(() => {
                    item.parentElement.remove();
                }, 5000);
            })
        );
    }, 3000);
};

I have to say, code above, I am using window.onload but nothing else really works. Anything I use, the process is always the same

  1. HTML SVG shows along with HTML texts
  2. THEN it shows a loading animation
  3. Finally loading animation disappears and everything is loaded.

Any advice would be great!

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