JQuery animations and Meteor

大憨熊 提交于 2020-01-05 10:38:25

问题


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?


回答1:


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



回答2:


Is that what you're looking for?

Example: http://jsfiddle.net/3JRfU/

.on('click','.delete', function (e) {
    $(this).fadeOut(1000);
});

or

.on('click','.delete', function (e) {
    $(e.target).fadeOut(1000);
});


来源:https://stackoverflow.com/questions/24783658/jquery-animations-and-meteor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!