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

107
Views
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
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!