animation - How to animate enter and leave of MeteorJS {{#if}} block? -


the title says all. given template:

{{#if selection}}     <div class="something">         <p>to animate</p>     </div> {{/if}} 

how control enter , exit animations of .something?

thanks.

you have create template out of dom containing stuff animate:

<templte name="somthing"> <div class="parentdiv"> {{#if selection}}     <div class="something">         <p>to animate</p>     </div> {{/if}} <div> </template> 

you can use _ui_hooks

template.something.onrendered(function() {  this.find('#task-list')._uihooks = {       insertelement: function(node, next) {         $(node).addclass('animate')           .insertbefore(next);          settimeout( function () {           $(node).removeclass('animte');         }, 20);       },       removeelement: function (node) {         $(node).addclass('animate')           .on(events, function() {             $(node).remove()           });       },     } }); 

so here css class containing animation animate.


Comments