Nistor Cristian
Nistor Cristian

Reputation: 1266

Ajax Load More fade effect

I'm trying to make a fade effect on a load more function.

.done(function(response) {
   $('.content').append(response).hide().prependTo(".content").fadeIn("slow");
   offset += limit;
});

I'm loading my posts in content div. The first time when I click Load More it makes the fadeIn effect. When I press second time it makes the effect but to the whole .content. My question is how to divide every load more content ?

<div class='content'>
  <div class='first-load'>
    // with fade in effect
  </div>
  <div class='second-load'>
    // only this div with fade in effect not the whole .content
  </div>
  ... etc
</div>

Upvotes: 0

Views: 968

Answers (1)

aquinas
aquinas

Reputation: 23786

Your code is kinda of weird. I think what you actually want is just this:

.done(function(response) {
   $(response).appendTo(".content").hide().fadeIn("slow");
   offset += limit;
});

Example:

http://jsfiddle.net/0r0uv6rw/

Upvotes: 3

Related Questions