how to add a preloader in website | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how to add a preloader in website

3rd Oct 2020, 8:06 AM
Coder
Coder - avatar
4 Answers
+ 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.
3rd Oct 2020, 8:14 AM
Raj Chhatrala
Raj Chhatrala - avatar
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 */
3rd Oct 2020, 8:17 AM
Kelvin Paul
Kelvin Paul - avatar
3rd Oct 2020, 8:25 AM
Kelvin Paul
Kelvin Paul - avatar