FadeTo() on this selection (cloned and appended) not working?

42 Views Asked by At

I'm new to jQuery and i'd like to fadeTo() this selection to give user feedback about data being fetched from the server:

// Loop on each array of object returned from the ajax call
$.each(v, function(i, obj) {
   current.find('.key:first').parent()
      .clone(true).appendTo(current)
         .find('.key').text(obj.key).andSelf();
};

I've tryed (without success) adding fadeIn('slow', 1) call after appendTo(current).

1

There are 1 best solutions below

0
On BEST ANSWER

From what I'm guessing, your content appears straight up and you wish it'd fade in.

You need to hide the cloned element before appending to the "current" element. Try this :

$.each(v, function(i, obj) {
   current.find('.key:first').parent()
      .clone(true).hide(1).appendTo(current).fadeIn('slow')
         .find('.key').text(obj.key).andSelf();
};