I am trying to apply a Lazy Load plugin to multiple containers. I found this similar question: Lazy Load on MULTIPLE horizontal containers .
this is my attempt: http://jsfiddle.net/BAFMC/
$(".p_outer_content").each(function() { var tthis = $(this); $(this).find('img').lazyload({ container: tthis }); });โ
But I have the same problem as the mentioned question: Lazy load is applicable only to the last container (.p_outer_content) (which is the third in the script).
Does anyone know how to solve this or have another suggestion? thanks in advance
EDIT:
Ok, I tried to reuse the lazyload function every time one of the containers scrolls:
$(".p_outer_content").each(function() { var tthis = $(this); $(this).find('img').lazyload({ container: tthis }); }); $(".p_outer_content").scroll(function() { var tthis = $(this); $(this).find('img').lazyload({ container: tthis }); });โ
http://jsfiddle.net/BAFMC/4/
Which works, but I don't know if this is a good solution. Has anyone, however, come up with a better solution? Thanks
source share