Use the jQuery ready event:
While JavaScript provides the load event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received.
题
In my new website, there are number of ajax calls.Now the content is displaying when it's ready. I want to add a pre-loader until everything in the div gets loaded completely. I've used load() function but its not working properly.
解决方案
Use the jQuery ready event:
While JavaScript provides the load event for executing code when a page is rendered, this event does not get triggered until all assets such as images have been completely received.