0

I read this.

I want to write a function which will make my page load slow(for perticular time), and I want to display browser's loading icon until the page loads completely, delay didn't worked as it only works with animation effects

Community
  • 1
  • 1
dEL
  • 482
  • 1
  • 6
  • 23
  • http://smallenvelop.com/display-loading-icon-page-loads-completely/ – claudios Nov 23 '16 at 07:18
  • 1
    I don't really see why anyone would want to do this, but you could try using the answer provided by Harsh over at [http://stackoverflow.com/a/25219740](http://stackoverflow.com/a/25219740) – Kevin F. Nov 23 '16 at 07:21
  • Thanks that was great, however browser loading icon is stopped when page, loaded – dEL Nov 23 '16 at 07:39
  • unless you hate your users, **why** would you ever deliberately want to make your page *slow*? – Franz Gleichmann Nov 23 '16 at 08:44
  • for some user, admin want to make the website slower and want users to purchase pro package to reduce loading time, so he will get more profit – dEL Nov 23 '16 at 17:05
  • I end up with implementing @KevinF. answer into site – dEL Nov 25 '16 at 12:47

1 Answers1

2

Keep your loading icon within a div with id loader with CSS as following.

#loader {
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0px;
    top: 0px;
}

And your jQuery as:

$(window).load(function() {
    $("#loader").hide();
});
Optimus Prime
  • 6,817
  • 5
  • 32
  • 60