I want to use fade in effect for my prepend function.
I have tried follow one but it is not working.
$('#iq').prepend('.....').fadeIn('slow')
Try the example below.
$('#test').prepend($('<div id="bob">Hi der</div>').fadeIn('slow'));
Live Demo
Since you are just fading in the elements you are prepending just do it within the prepend
as you add them, this also has the benefit of not forcing you to hide them first.
prepend
returns the elements in the object you call it on, not the new elements, so you're calling fadeIn
on the elements you're pre-pending the new content to. Instead, you want prependTo
, which is basically prepend
the other way 'round. (See the docs for details.) Also, you need to hide
the new elements before fading them in, so:
$('.......').prependTo('#iq').hide().fadeIn('slow');
Live example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With