user3038421
user3038421

Reputation: 25

JQuery fade in effect without hiding elements inside

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

Answers (3)

Rajaprabhu Aravindasamy
Rajaprabhu Aravindasamy

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

Arun P Johny
Arun P Johny

Reputation: 388396

Use appendTo() to target the elements that are being appended

$(data).hide().appendTo($this.find('.wrapper_middle')).fadeIn(500);

Upvotes: 1

adeneo
adeneo

Reputation: 318302

$this.find('.wrapper_middle').append($(data).hide().fadeIn(500));

or

$(data).hide().fadeIn(500).appendTo( $('.wrapper_middle', $this) );

Upvotes: 1

Related Questions