Can I just use jQuery's $(document).ready(function(){ //content }); and a quick solution for lazy loading?
- 1Can you give a little more detail?switz– switz2011-07-26 18:19:20 +00:00Commented Jul 26, 2011 at 18:19
- Our stat and ads JS hold up the page load so I want those two things to load after everything else.ok1ha– ok1ha2011-07-26 18:55:02 +00:00Commented Jul 26, 2011 at 18:55
- 2Then you don't want lazy loading, but you do want $(document).ready processing. With some care, this can be done nicely from this.Schroedingers Cat– Schroedingers Cat2011-07-26 21:25:32 +00:00Commented Jul 26, 2011 at 21:25
Add a comment |
2 Answers
$(document).ready does not give lazy loading. What it does is wait for the page elements to finish loading before running the script - which is very useful and important when the code is manipulating elements in the page.
Lazy loading strictly would involve loading parts of the page or the data only on demand, only when needed. If you actually need lazy loading, you need to do it properly. If you just need the page elements to have loaded then $(document).ready is fine.