+ 4
Akash Agrawal that's not the purpose of loader! You don't have to make people wait for your show off
Misfit just make 2 div tags and the first for loader and second for main content!
In the css part, just add a style for the main div 'display:none'
And then do this in js,
window.onload = function () {
Loader = document.get .....
Main = document.get ......
Loader.style.display = "none";
Main.style.display = "block";
// As soon as the images, videos etc load, the loader will end and the main content will be shown!
}
=> It's not a good practice as @Akash Agrawal said to do đ
=> Put loader only in big projects where you are inserting many images and all!
=> Animate the loader using css (js will not work most of the time, as window has not been loaded yet, element pointers won't work)
=> It's not necessary to insert loader in every project!
+ 2
Akash Agrawal that's what I am saying, never set time for the loader
Loader will itself end when everything has been loaded. (Read my answer if still facing confusion with how to use loaders)
+ 1
Namit Jain I know . Loader is not a show off but you when your data are loaded so you can write script when your page are load so you can clear the setTimeout function.
Ok đ
0
Use setTimeout function for loader
And you can set the time of loader .
And after the time spent you clear the list loader.
Use clearInterval function.



