HTML LOADING

Source Code:


 <!DOCTYPE html>

<html>

<head><style>

body {

    font-family:"Arial", cursive;

}

#page {

    display: none;

}

#loading {

    display: block;

    position: absolute;

    top: 0;

    left: 0;

    z-index: 100;

    width: 100vw;

    height: 100vh;

    background-color: black;

    background-image: url("https://upload.wikimedia.org/wikipedia/commons/e/ee/Loadinginjg.gif");

    background-repeat: no-repeat;

    background-position: center;

}


</style></head>

<body>

<script>

function onReady(callback) {

    var intervalID = window.setInterval(checkReady, 1000);


    function checkReady() {

        if (document.getElementsByTagName('body')[0] !== undefined) {

            window.clearInterval(intervalID);

            callback.call(this);

        }

    }

}


function show(id, value) {

    document.getElementById(id).style.display = value ? 'block' : 'none';

}


onReady(function () {

    show('page', true);

    show('loading', false);

});

</script>

<div id="page">

  

  

  

 

</div>



<div id="loading"></div>

</body>


</html>






Refresh for Output


Comments

Popular posts from this blog

What is a Blogs? How to create account on Blog?

What is JAVASCRIPT?How to make a program using HTML and Java | "Hello World" | Prakhar Doneria

HOW TO ADD PIE CHART IN HTML | PRAKHAR DONERIA