Reputation: 25
In this code I am using the fadein effect to append the data. The problem is that everything in wrapper_middle hides and then fades in.. How can I add this effect only to the data appended ?
$this.find('.wrapper_middle').hide().append(data).fadeIn(500);
Upvotes: 0
Views: 101
Reputation: 67207
.append()
will return the object of the element
to which you appended the new element
. But .appendTo()
is opposite to that, It will return the object of the appended element
. .appendTo() will suit your need.
Try this,
$(data).appendTo($this.find('.wrapper_middle')).hide().fadeIn(500);
Upvotes: 1
Reputation: 388396
Use appendTo() to target the elements that are being appended
$(data).hide().appendTo($this.find('.wrapper_middle')).fadeIn(500);
Upvotes: 1
Reputation: 318302
$this.find('.wrapper_middle').append($(data).hide().fadeIn(500));
or
$(data).hide().fadeIn(500).appendTo( $('.wrapper_middle', $this) );
Upvotes: 1