+ 1
how to add a preloader in website
4 ответов
+ 5
1) Write HTML and CSS for preloader.
2) set display: none; for main content container (<main> tag)
3) using JS onload event, set display to none for preloader and block (maybe flex or grid) to main content container.
0
Using window.onload method
Or
addEventListener ("load",fun)
Method
These ajax based events. Functions of these events are much similar.
So create a preloader layout then
window.onload=function(){
preloaderObject.remove()
}
/*preloader layout will be removed after the loading
Because the function will be called after loading of your web page
*/