JQuery动画和流星 [英] JQuery animations and Meteor

查看:75
本文介绍了JQuery动画和流星的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在删除记录后尝试制作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 - 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆