问题
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