jQuery Plugin For Adding Entrance Effects To Elements showByScroll - Download JavaScript Plugin For Adding Entrance Effects To Elements - showByScroll

Download JavaScript Plugin For Adding Entrance Effects To Elements – showByScroll

Posted on

This time I will share jQuery Plugin and tutorial about JavaScript Plugin For Adding Entrance Effects To Elements – showByScroll, hope it will help you in programming stack.

jQuery Plugin For Adding Entrance Effects To Elements showByScroll - Download JavaScript Plugin For Adding Entrance Effects To Elements - showByScroll
File Size: 5.36 KB
Views Total: 2226
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

showByScroll is a super simple jQuery/Vanilla JavaScript plugin that adds CSS3 based entrance effects to elements when scrolling down the webpage.

How to use it:

1. Link to jQuery library (OPTIONAL) and the showByScroll plugin as follows:

1 <script src="/path/to/jquery.min.js"></script>
2 <script src="/path/to/show-by-scroll.min.js"></script>

2. Call the plugin to detect whether an element scrolled into view.

01 // Vanilla JavaScript
02 const elements = document.querySelectorAll('.showbyscroll');
03 new ShowByScroll(elements, {
04  
05     // which class add when the object is visible
06    'class': 'show',
07  
08     // screen height divided by the Index
09     'offsetIndex': 1.5,
10  
11     // delay in milliseconds
12     delay: 0
13  
14 });
15  
16 // jQuery Plugin
17 $( '.showbyscroll' ).showByScroll({
18  
19   // which class add when the object is visible
20   'class': 'show',
21  
22   // screen height divided by the Index
23   'offsetIndex': 1.5
24  
25   // delay in milliseconds
26   delay: 0
27  
28 });

3. Add custom CSS animations to the element when scrolled into view.

1 .show {
2   opacity: 1;
3   transform: translate(0, 0);
4 }

4. Trigger a function after the element has been scrolled into view.

1 // Vanilla JavaScript
2 element.addEventListener('showedByScroll', function() {
3   // do something
4 })
5  
6 // jQuery Plugin
7 $('.showbyscroll').on('showedByScroll', function() {
8   // do something
9 });

Changelog:

2019-07-21

  • Added delay option

2019-07-16

  • Added vanilla JS version

This awesome jQuery plugin is developed by Kraigo. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net