We have provided very easy step and simple code for your Magento 2 project while page loading.
Step 1. Open your "copyright.phtml" and add this after tag.
(Please add this "copyright.phtml" file in this path : Magento_Theme\templates\html)
Step 2. Add this following code.
Step 3. Add this following CSS in your stylesheet.(please create loader image like gif,svg)
Step 4. Please clean cache: php bin/magento cache:clean
Now refresh your page and show result.
Note : if this example not works please add this jquery :
(Please add this "copyright.phtml" file in this path : Magento_Theme\templates\html)
Step 2. Add this following code.
Step 3. Add this following CSS in your stylesheet.(please create loader image like gif,svg)
.loader{position:fixed;left:0;top:0;width:100%;height:100%;z-index:99999999;background:url(../images/pageLoader.svg) 50% 50% no-repeat #000}
Step 4. Please clean cache: php bin/magento cache:clean
Now refresh your page and show result.
Note : if this example not works please add this jquery :