jQuery lazy loading image with throttling?
-
I've been given a design for a commercial affiliate-related website where the homepage has 2500+ images on it. Two directions I'm thinking about to ease the loading of the images is to utilize a lazy image loading script. I've been messing with the jQuery JAIL (Async Image Loader) script. I have it set so that it loads all the visible images when the page loads. Then after a couple seconds it begins downloading all the rest of the images on the page that are below the fold. This is typically like 2400+ images. The problem is that when the browser is told to download 2400 images it basically freezes up, or at least freezes up the scrollbar until it's done. Are there any jQuery image loading scripts that are similar to the JAIL but that allow for some type of throttling? Anything really to help from freezing up the page. I'm also looking into css sprites but for various technical reasons and time constraints it might not be feasible.
-
Answer:
Use this http://www.appelsiini.net/projects/lazyload. Example http://ivorycity.com/blog/2011/04/19/jquery-lazy-loader-load-html-and-images-on-scroll/ It delays loading of images in long web pages. Images outside of viewport (visible part of web page) wont be loaded before user scrolls to them. Using Lazy Load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load.
Jakobud at Stack Overflow Visit the source
Other answers
If the images are small, you might consider combining them into fewer large images and loading them all at once, displaying them all as <div> elements with their background image set. Example: http://jsfiddle.net/XXRwD/
jzila
Related Q & A:
- How to change thin image to fat image in iPhone SDK?Best solution by Stack Overflow
- How to implement different clickable Area on an image-page through image map?Best solution by Stack Overflow
- How to lazy open resource and eagerly release?Best solution by stackoverflow.com
- How to not be lazy and focus on studies?Best solution by Quora
- How do you make a lazy eye less noticeable in pictures?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.