Odometer-style Number Roll Effect With jQuery - gScrollNumber.js

Odometer-style Number Roll Effect With jQuery - gScrollNumber.js
File Size: 3.48 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

gScrollNumber.js is an easy-to-use jQuery plugin for animating countups with a smooth number scrolling effect just like the Odometer. Based on CSS3 transitions.

How to use it:

1. Download and insert the JavaScript file gScrollNumber.js after jQuery library (slim build).

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" 
        integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" 
        crossorigin="anonymous">
</script>
<script src="gScrollNumber.js"></script>

2. Create a new gScrollNumber instance to initialize the counter.

<div class="scroll-number-demo"></div>
var scrollNumber = new gScrollNumber(".scroll-number-demo", {
    // options here
});

3. The example to start a basic counter.

var  value0 = 0;
setInterval(function () {
  scrollNumber.run(value0++);
}, 1000);

4. Customize the odometer counter with the following options.

var scrollNumber = new gScrollNumber(".scroll-number-demo", {

    // width in pixels
    width: 30, 

    // text color
    color: "orange",

    // font size
    fontSize: 40, 

    // auto resizes container's width
    autoSizeContainerWidth: true
    
});

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