Can I just use jQuery’s $(document).ready(function(){ //content });
and a quick solution for lazy loading?
Leave a Reply
You must be logged in to post a comment.
Can I just use jQuery’s $(document).ready(function(){ //content });
and a quick solution for lazy loading?
You must be logged in to post a comment.
$(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.All the handlers passed to
$(document).ready
method are executed once the DOM in ready so it is not going to help with lazy loading. For lazy loading you might have to write your own logic.