开发者

jQuery Prepending a DIV by sliding it down

开发者 https://www.devze.com 2023-01-21 10:29 出处:网络
$(\'#container\').prepend(\"<ul><li>Stuff</li></ul>\').hide().开发者_如何学CslideDown();
$('#container').prepend("<ul><li>Stuff</li></ul>').hide().开发者_如何学CslideDown();

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.


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();
0

精彩评论

暂无评论...
验证码 换一张
取 消