I have a website with tons of images, so I created infinite scroll with ajax, and also I'm using lazyload plugin: http://www.appelsiini.net/projects/lazyload
My problem is: I want to use fadeIn effect for loading images, this is fine when I load first set of images, but when I click on "Load more", fadeIn effect is applied to those images which are already visible and to those which are currently loading. So those images which are already loaded dissapear and appear with fadeIn effect.
How to apply fadeIn effect only to images which are currently loading?
This is how I load images:
$(".loadMore").click(function(){
... some validation
$.ajax({
type: "POST",
url: "/loadMore/"+option+"/"+posts,
dataType: "json",
beforeSend: function(){
t.html(lang.loading);
},
success: function(data){
t.html(lang.loadMore);
for(var i in data.posts.id){
append(data.posts.id[i], data.posts.countComments[i], data.posts.image[i], data.posts.title[i], data.posts.link[i], data.posts.username[i], data.posts.date[i], data.posts.new_tab[i], data.posts.is_saved[i], false);
}
if(data.msg == "stop"){
t.hide();
}
$("img.lazy").lazyload({skip_invisible : false,failure_limit : 15, effect: "fadeIn"});
}
});
});