1

I have some html/php pages with large amount of data. It takes few more extra seconds to load from the server. Is there any way to show "loader animation" for html pages/php pages using jquery? After completely loading the html/php page, the "loader animation" should be hide.

Thanks in advance

Ra.
  • 935
  • 4
  • 18
  • 30

3 Answers3

1

Sure.

Attach some javascript to the pages load event to a) show the 'Loading' animation b) kick off an ajax call to load the data and then c) clear the animation once finished.

Its pretty standard stuff - any AJAX tutorial will give you enough.

pauljwilliams
  • 19,079
  • 3
  • 51
  • 79
1

You can use the AJAX functions as : ajaxStart() http://api.jquery.com/ajaxStart/ and ajaxStop() http://api.jquery.com/ajaxStop/

Flipke
  • 971
  • 6
  • 10
0

Simplest way :

You put a <div class="loader"></div> in head which loaded everytime on everypage, then create a function :

function hideLoad(){$('.loader').hide();}

and put onload in body tag as :

<body onload="hideLoad()">

that allow div to be showed up untill everything has been loaded.

Rey Musa
  • 122
  • 6