This time I will share jQuery Plugin and tutorial about 17+ Scroll Animations For Single Page App – jQuery Skroll, hope it will help you in programming stack.
A jQuery vanilla JavaScript scroll animation plugin which provides 17+ CSS3 powered scroll-triggered animations for page elements when they’re scrolled into view.
Highly customizable and you can enable/disable the scroll animations on mobile devices.
How to use it:
1. Load the latest version of the Skroll plugin at the end of the document.
1 |
< script src = "skroll.min.js" ></ script > |
2. Initialize the Skroll plugin on specific element(s) within the document.
3. Set the scroll animation you prefer. All possible animation types:
- zoomIn (Default)
- fadeInLeft
- fadeInRight
- fadeInLeftBig
- fadeInRightBig
- fadeInUp
- fadeInDown
- slideInLeft
- slideInLeftBig
- slideInRight
- slideInRightBig
- flipInX
- flipInY
- rotateRightIn
- rotateLeftIn
- growInLeft
- growInRight
1 |
new Skroll().add( ".element" ,{ |
4. Additional options to customize the animation.
5. Customize the top/bottom offsets to trigger the scroll animation.
1 |
new Skroll().add( ".element" ,{ |
6. Event handlers.
1 |
new Skroll().add( ".element" ,{ |
3 |
onEnter: function (index,e) {}, |
4 |
onLeave: function (index,e) {}, |
7. To enable the scroll animation on mobile devices, change the mobile:false
to true
in the JS.
8. Add your own animations:
07 |
el.style[ "transform" ] = "scale(.1,.1)" ; |
08 |
el.style[ "opacity" ] = 0; |
11 |
el.style[ "transform" ] = "scale(1,1)" ; |
12 |
el.style[ "opacity" ] = 1; |
9. Recalculate the position of elements.
1 |
new Skroll().recalcPosition(); |
Changelog:
v2.0.0 (2019-03-10)
- dropped jQuery dependency
- bugs fixed
This awesome jQuery plugin is developed by akzhy. For more Advanced Usages, please check the demo page or visit the official website.