Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate new "content" with CSS (or Jquery) in handlebars js

I'm really new with handlebars.js maybe this is an easy question but I can't figure it out.

Is there a way to animate the template when I send new data using $('#content').html(html); ?

Something like a CSS3 transition or jQuery Animation.

I don't know if that is possible, if so, where to do it.

Thanks

like image 669
distante Avatar asked Jan 20 '26 21:01

distante


1 Answers

Well I was downvoted but I think my answer will help others.

What I did was to first hide the #content DIV using jQuery's .hide() after the handlebar code. When handlerbar is done I re show the div using JQuery's .show:

function animals(){
    $('#content').hide('fast'); // ANIMATED CLASS REMOVED
    showTemplate(categories_template,animals_data); // Handlbars stuff
    $('#content').show('fast'); // ANIMATED CLASS RE ADDED
}
like image 182
distante Avatar answered Jan 23 '26 12:01

distante



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!