Lazy load lets you serve up an image heavy website without having to suffer with all the prefetching and loading of images that may never be seen by the user.
How to add lazy loading using jQuery?
Use the following code, you should incorporate the jquery.lazyload.js
script file. We have shared a simple, jQuery based lazy loading example:
1 2 3 4 5 | <script src="jquery.js" type="text/javascript"></script> <script src="jquery.dimensions.js" type="text/javascript"></script> <script src="jquery.lazyload.js" type="text/javascript"></script> Next, you can use the lazyload() method as shown below: $("imageObject").lazyload(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.