I found what I was looking for on this link How to show ajax loading gif animation while the page is loading? but I dont know how to implement this on my website.
I want a loading GIF to appear while the page loads and disappears by itself once the page is completely loaded with PHP results.
On the website I use one page template (index.php) and I have all data loaded in that page dynamically according to the user’s query.
Thank you in advance.
Well, this is my solution.
1) CSS part
2) HTML part
Place div tag within body tag anywhere.
3) Javascript part
I made two functions, one to show and another to hide the div.
4) Showing the div.
Call function showloadgif() using onlick=”” event anywhere.
For example
Once the image is clicked, the div will appear and at the same time, hideloadgif() will trigger and hides the div within 3 seconds.