开发者

jQuery animate .prepend

开发者 https://www.devze.com 2023-01-13 01:43 出处:网络
Rather than开发者_StackOverflow simply dumping the HTML into the page I want it to be animated, how can I change the jQuery below to either animate or slide down as the HTML is inserted?

Rather than开发者_StackOverflow simply dumping the HTML into the page I want it to be animated, how can I change the jQuery below to either animate or slide down as the HTML is inserted?

$('.button').click(function() {

j('.tweets ul').prepend(j('.refreshMe ul').html());

});


You can .hide() the content before doing a .prependTo(), then call .slideDown() on the element, like this:

$('.button').click(function() {
 j('.refreshMe ul > *').clone().hide().prependTo('.tweets ul').slideDown();
});

This does .clone() of the children to move, rather than doing an innerHTML style copy, hides the cloned elements before moving them, then slides them down.

0

精彩评论

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