views:

47

answers:

1

hello everbody,

after some research and after I've asked some questions, I've realized the following: jQuery plugin Lazy Load (http://www.appelsiini.net/projects/lazyload) doesn't work on Safari and even not on Firefox.

I've just tested their demo.

Please you need to use Firebug, and see how all the images are loaded at once at the beginning and then loaded again on scroll (so you actually have double downloading).

Could you give me a solution how to implement the mashable.com images lazy layout ?

thanks

+2  A: 
do this

 <img alt='some_text'  _src="img_url" class='lazyLoad'>
  // please note i have added underscore character before 'src'

jQuery(function(){
     jQuery('.lazyLoad').each(function(){
           var _elm= jQuery(this);
           _elm.attr('src',_elm.attr('_src'));

           //on DOM ready loop through each 
          //image with class=lazyLoad and add src attribute to it.
       })
});
Praveen Prasad
mhm, so the only way is to change the original code ? This is a bit problematic for me, since I don't have just a static page.
Patrick
are you looking for something like: on initial load display only those images which exist is visible area of window and load more images when scroll happens. like youtube does.??
Praveen Prasad
@Praveen Prasad A good example is mashable.com . But the point is that I cannot change the original html code (i.e. _src) as you suggest. From what I can see the only way is to change the original code.
Patrick