Many sites appear to only download images or generate parts of the document (eg for reviews) when the user scrolls far enough down the page to actually see them.
This obviously will give you faster loading pages and save on bandwidth for anyone that does not bother scrolling down.
How is this done, ideally with jquery? Or to ask it another way, how do I detect that a missing image has just scrolled into view and needs to be fetched?
Here is my own. Have Fun. (doesn't require jQuery!)
Tested: IE 5.5+, FF 2+, Chrome, Opera 9.6+
Usage:
your lazyloaded images should have their real src in a thumb attribute
Just include the javascript file inline or externally.
If you don't want to use it on your entire page, you can do:
Note: when you include the file a global instance is already created watchin the whole document. You need to stop that first and start you own instance.
set a custom offset for prefetching (how far below the fold the image should be fetched)
Code:
There are plugins for that. Here's one...