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?
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(); });