This is actually pretty easy to do. All you have to do is change the css.
Here's a script with a very simple fade animation: http://jsfiddle.net/elthrasher/sNpjH/
To turn it into a rolling animation, I first had to put my element in a field (this is a slide container), then I added another element to replace the one that was leaving, just because I thought it would look beautiful. Take it , and the example will work.
I changed the css animation from "fade" to "slide", but note that these are the names I gave them. I could write a css slide animation called "fade" or anything else for that matter.
The important part is what is in css. Here's the original "fade" css:
.fade-hide, .fade-show { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; } .fade-hide { opacity:1; } .fade-hide.fade-hide-active { opacity:0; } .fade-show { opacity:0; } .fade-show.fade-show-active { opacity:1; }
This code changes the opacity of an element from 0 (completely transparent) to 1 (completely opaque) and vice versa. The solution is to leave the opacity alone and instead change the top (or left if you want to move left-right).
.slide-hide, .slide-show { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; } .slide-hide { position: relative; top: 0; } .slide-hide.slide-hide-active { position: absolute; top: -100px; } .slide-show { position: absolute; top: 100px; } .slide-show.slide-show-active { position: relative; top: 0px; }
I also move from relative to absolute positioning, so only one of the elements takes up space in the container at a time.
Here's the finished product: http://jsfiddle.net/elthrasher/Uz2Dk/ . Hope this helps!