Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Prepending a DIV by sliding it down

Tags:

jquery

css

$('#container').prepend("<ul><li>Stuff</li></ul>').hide().slideDown();

I want the NEW UL to slide Down. but the above is sliding down the entire #container..

How can I prepend an item to the top, and then slide it down.. Kinda like how Twitter used to show you your new tweet.

Thank you.

like image 542
user479959 Avatar asked Oct 21 '10 01:10

user479959


1 Answers

You can try using this syntax instead:

$('<ul><li>Stuff</li></ul>').prependTo('#container').hide().slideDown();

Of course, if you're using a list like that it might be useful to construct it element by element like this:

var ul = $('<ul />').prependTo('#container');
$('<li />').appendTo(ul).text('Incoming!').hide().slideDown();
like image 73
Yi Jiang Avatar answered Oct 14 '22 02:10

Yi Jiang