Loading GIF Loader In Center of Webpage

While page is loading sometimes it takes too much time for that time duration we can show GIF loader or any kind of loader to the users so users can know easily something is happens.

Add Loader - Education Funda
Add Loader To Your Webpage

 

Such as your webpage html code is like below:

<body>
    <div class="content">
        Long Content Here
        <br/>
        Click to view loading image.
    </div>
    <div id="divLoading" style="display:none">
    </div>

</body>

We added one div here with the ID divLoading, you can take any ID selector as per your need.

Now in webpage you need to add css code so that loader can be show in center of page at any screen size:

<style type="text/css">
    #divLoading.show
    {
        display : block;
        position : fixed;
        z-index: 100;
        background-image : url('spinner.gif');
        background-color:#666;
        opacity : 0.4;
        background-repeat : no-repeat;
        background-position : center;
        left : 0;
        bottom : 0;
        right : 0;
        top : 0;
    }
</style>



<script type="text/javascript">
$(document).ready(function(){
    $("div.content").click(function(){
        $("div#divLoading").addClass('show');
    });
});
</script>


Comments

Popular posts from this blog

JavaScript Logical Output Based Interview Questions

Create and Deploy AWS SAM Application

Deploy Angular Build With Express JS Project