My webpage has content that loads with animation applied to them. The problem is the content starts loading without the animation, CSS hasn't even finished downloading. I have added a preloading bar overlay to wait for the content loading BUT the webpage loads in middle without the animation and overlay loader is still working..
At the end content loads without animation shown.
I found that there is a window.stop() method which can completely stop rendering BUT there is NO window.load() method.
{...heading...}
<script src="mainPage/js/loading.js"></script> <!-- loading bar calculation to perform -->
</head>
<body>
<div id="overlay">
<div id="progstat"></div>
<div id="progress"></div>
</div>
<script src="mainPage/node_modules/aos/dist/aos.js"></script> <!-- web content animation script so that it loads as soon as possible -->
{..body..}
loading.js content from stackoverflow question What can I do? Thanks in advance
EDIT 1
You can try doing Progressive image loading as here stackoverflow Below answer is also correct.