Skip to content

Instantly share code, notes, and snippets.

@benstr
Created October 9, 2014 21:50
Show Gist options
  • Select an option

  • Save benstr/3501d0b90d5f34d205da to your computer and use it in GitHub Desktop.

Select an option

Save benstr/3501d0b90d5f34d205da to your computer and use it in GitHub Desktop.
Animate Routes with IronRouter and VelocityJS
<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
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment