show loading icon until the page is load?

前端 未结 7 1303
不知归路
不知归路 2020-11-29 19:42

I wanted to show a loading icon to users until the page elements are fully loaded. How can I do that with javascript and I want to do it with javascript, not jquery?

相关标签:
7条回答
  • 2020-11-29 20:47

    HTML page

    <div id="overlay">
    <img src="<?php echo base_url()?>assest/website/images/loading1.gif" alt="Loading" />
     Loading...
    </div>
    

    Script

    $(window).load(function(){ 
     //PAGE IS FULLY LOADED 
     //FADE OUT YOUR OVERLAYING DIV
     $('#overlay').fadeOut();
    });
    
    0 讨论(0)
提交回复
热议问题