Let's animate our Meteor sites!
Using VelocityJS and IronRouter.
- Inspired by comicsans.ro | GitHub
Using VelocityJS and IronRouter.
| <template name="layout"> | |
| <div class="container"> | |
| {{> yield}} | |
| </div> | |
| </template> |
| Template.layout.events({ | |
| 'click .btn': function () { | |
| // this is the transition out | |
| $('.transition').velocity('transition.bounceUpOut', { | |
| stagger: 500 / 3, | |
| duration: 500, | |
| 'complete': function () { | |
| Router.go('someOtherTemplateName'); | |
| } | |
| }); | |
| } | |
| }); |
| Router.configure({ | |
| layoutTemplate: 'layout' | |
| }); | |
| Router.map(function() { | |
| this.route('uniqueTemplateName', { | |
| path: '/', | |
| template: 'uniqueTemplateName' | |
| }); | |
| }); |
| .transition { | |
| opacity: 0 | |
| } |
| <template name="uniqueTemplateName"> | |
| <div class="transition"> | |
| <div class="content"> | |
| lorem ipsum .... | |
| </div> | |
| </div> | |
| </template> |
| //This will control the entry transition | |
| Template.uniqueTemplateName.rendered = function () { | |
| $('.transition').velocity('transition.bounceUpIn', { //you can use any velocity action | |
| stagger: 500 / 3, | |
| duration: 500 | |
| }); | |
| }; |