How to use pre loader in your website!

 


Read my post for details:

https://stackoverflow.com/a/68282697/16397379


Just declare all the required css and script codes inside the head tag of your index.html. You can follow my code given below:


**index.html**
<!DOCTYPE html>
<html lang="en">
<head>
<script>
    //preloader
        function myFunction() {
            document.getElementById('loading').style.visibility = "hidden";
        }
        setTimeout("myFunction()", 8000);
</script>
<style>
 #loading {
            position: fixed;
            width: 100%;
            height: 100vh;
            background: rgb(24, 32, 39) url("./loading.gif") no-repeat center;
            z-index: 99999;

        }
</style>
</head>
<body>
    <!-- Pre loader-->
    <div id="loading" style="visibility: visible;">
    </div>
</body>

Comments