JQuery动画和流星 [英] JQuery animations and Meteor
问题描述
在删除记录后尝试制作fadeOut动画。在事件中它看起来像这样:
Trying make a fadeOut animation after removing an record. In events it's look like that:
'click .delete': function (e) {
$(e.target).fadeOut(1000);
Vals.remove(this._id);
}
但这不起作用。动画如何正确?
But this is doesn't work. How do animations properly?
推荐答案
大多数现有的jQuery动画实现与Meteor无关。你想要做的是使用动画钩子,这些钩子在数据改变时自动激活:
Most of the existing jQuery animation implementations aren't relevant for Meteor. What you'll want to do is to use the animation hooks which are automatically activated when data changes:
https://groups.google.com/d/msg/meteor-core/1kUoG2mcaRw/j4bNvXu36IoJ
这对于代码稳健性也更好,因为您不必跟踪 时动画的东西,而不仅仅是如何动画它们。以下是几个例子:
This is also better for code robustness, as you don't have to keep track of when to animate things, but rather just how to animate them. Here are a couple of examples:
- https://github.com/mizzao/meteor-animated-each - 淡入/淡出并在添加/删除时调整滚动位置。在 http://animated-each.meteor.com/ 上进行演示。
- https://github.com/percolatestudio/transition-helper
- https://github.com/mizzao/meteor-animated-each - fades in/out and adjusts scroll position when adding/removing. Demo at http://animated-each.meteor.com/.
- https://github.com/percolatestudio/transition-helper
这篇关于JQuery动画和流星的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!