jQuery动画.prepend [英] jQuery animate .prepend
本文介绍了jQuery动画.prepend的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不只是将HTML转储到我希望动画化的页面中,而是如何在插入HTML时将下面的jQuery更改为动画或向下滑动?
Rather than 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());
});
推荐答案
您可以 .hide()
内容,然后再执行 .prependTo()
,然后调用
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();
});
这确实使 .clone()
可以移动,而不是进行innerHTML样式的复制,在移动克隆的元素之前将其隐藏,然后将其向下滑动.
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.
这篇关于jQuery动画.prepend的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文