animated counter when visible - Free Download Animated Number Counter That Runs When Visible

Free Download Animated Number Counter That Runs When Visible

Posted on

This time I will share jQuery Plugin and tutorial about Animated Number Counter That Runs When Visible, hope it will help you in programming stack.

animated counter when visible - Free Download Animated Number Counter That Runs When Visible
File Size: 4.94 KB
Views Total: 3928
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A tiny and configurable jQuery number counter plugin for counting up or counting down to the desired number when the counter element is scrolled into view.

How to use it:

1. Download and insert the multi-animated-counter.js script after jQuery.

1 <script src="/path/to/cdn/jquery.min.js"></script>
2 <script src="/path/to/multi-animated-counter.js"></script>

2. Create a counter element and use the data-TargetNum attribute to determine the number you want to countup to.

1 <div id="counters_1">
2   <div class="counter"
3        data-TargetNum="98765">
4   </div>
5 </div>

3. Determine the animation speed using the data-Speed attribute. Default: 3000ms.

1 <div id="counters_1">
2   <div class="counter"
3        data-TargetNum="98765"
4        data-Speed="7000">
5   </div>
6 </div>

4. Reverse the counter to create a countdown animation.

1 <div id="counters_1">
2   <div class="counter"
3        data-TargetNum="98765"
4        data-Direction="reverse">
5   </div>
6 </div>

5. Apply an easing function to the animation. ‘linear’ or ‘swing’.

1 <div id="counters_1">
2   <div class="counter"
3        data-TargetNum="98765"
4        data-Easing="linear">
5   </div>
6 </div>

6. Add counter groups to the page as follows:

01 <div id="counters_1">
02   <div class="counter" data-TargetNum="10" data-Speed="6000"></div>
03   <div class="counter" data-TargetNum="7" data-Speed="7000"
04   data-Direction="reverse" data-Easing="linear"></div>
05   <div class="counter" data-TargetNum="80333" data-Speed="2500">0</div>
06 </div>
07  
08 <div id="counters_2">
09   <div class="counter" data-TargetNum="4200" data-Speed="1000">0</div>
10   <div class="counter" data-TargetNum="4500" data-Speed="4000">0</div>
11   <div class="counter" data-TargetNum="4743">0</div>
12 </div>
13  
14 <div id="counters_3">
15   <div class="counter" data-TargetNum="5200" data-Speed="1000">0</div>
16   <div class="counter" data-TargetNum="5500" data-Speed="4000">0</div>
17   <div class="counter" data-TargetNum="5743">0</div>
18 </div>

7. Default global settings.

1 // must be an array, could have only one element
2 let visibilityIds = ['#counters_1', '#counters_2', '#counters_3'];
3  
4 // default counter class
5 let counterClass = '.counter';
6  
7 // default animation speed
8 let defaultSpeed = 3000;

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