Append an element with fade in effect [jQuery]
$(html).hide().appendTo("#mycontent").fadeIn(1000);
Adding a little more info:
jQuery implements "method chaining", which means you can chain method calls on the same element. In the first case:
$("#mycontent").append(html).fadeIn(999);
you would be applying the fadeIn
call to the object which is target of the method chain, in this case #mycontent
. Not what you want.
In @icktoofay's (great) answer you have:
$(html).hide().appendTo("#mycontent").fadeIn(1000);
This basically means, create the html
, set it as hidden by default, append it to #mycontent
and then fade it in. The target of the method chain now is hmtl
instead of #mycontent
.