This time I will share jQuery Plugin and tutorial about Full Page Transitions with jQuery and CSS3 – cssPageTransitions, hope it will help you in programming stack.
cssPageTransitions is a jQuery plugin which utilizes AJAX method and CSS3 animations to create smooth transition effects as you jump to other web pages.
Basic usage:
1. Include the jQuery cssPageTransiitons plugin after jQuery JavaScript library as follow:
1 |
< script src = "//code.jquery.com/jquery-2.1.4.js" ></ script > |
2 |
< script src = "jquery.cssPageTransitions.js" ></ script > |
2. Add custom CSS3 animations for the page transitions.
03 |
transform: translate 3 d( -100% , 0 , 0 ); |
08 |
transform: translate 3 d( 0 , 0 , 0 ); |
15 |
transform: translate 3 d( 0 , 0 , 0 ); |
20 |
transform: translate 3 d( 100% , 0 , 0 ); |
27 |
transform: translate 3 d( 100% , 0 , 0 ); |
32 |
transform: translate 3 d( 0 , 0 , 0 ); |
38 |
transform: translate 3 d( 0 , 0 , 0 ); |
43 |
transform: translate 3 d( -100% , 0 , 0 ); |
48 |
.is-movein- left , .is-movein- right , .is-moveout- left , .is-moveout- right { |
49 |
backface- visibility : hidden ; |
56 |
.is-movein- left { animation: prev-movein 0.5 s cubic-bezier( 0.445 , 0.05 , 0.55 , 0.95 ); } |
59 |
animation: prev-moveout 0.5 s cubic-bezier( 0.445 , 0.05 , 0.55 , 0.95 ); |
60 |
animation-fill-mode: forwards; |
63 |
.is-movein- right { animation: next-movein 0.5 s cubic-bezier( 0.445 , 0.05 , 0.55 , 0.95 ); } |
66 |
animation: next-moveout 0.5 s cubic-bezier( 0.445 , 0.05 , 0.55 , 0.95 ); |
67 |
animation-fill-mode: forwards; |
3. Create a link pointing to the next page.
1 |
< a href = "page2.html" class = "next" >Next Article</ a > |
4. Add page transitions to the next link.
1 |
$( '.next' ).cssPageTransitions( { |
2 |
elementsOut: 'article' , |
3 |
classOut: 'is-moveout-right' , |
4 |
classIn: 'is-movein-right' , |
5 |
animationEnded: function () { |
6 |
$( '.is-moveout-right' ).remove(); |
7 |
registerCssTransitions(); |
5. Initialize the plugin.
1 |
$( document ).ready( function () { |
2 |
registerCssTransitions(); |
6. Available options.
08 |
elementsOut: 'article' , |
11 |
elementsIn: 'article' , |
14 |
classOut: '.is-moveout' , |
17 |
classIn: '.is-movein' , |
20 |
alignWithPrevious: true , |
26 |
source : jqueryscript.net