Jquery.numscroll.js is a jquery digital scroll accumulation animation plug-in, using this plug-in can quickly create cool digital accumulation animation effects

Download address

  • Github.com/chaorenzeng…

Results show

Quick to use

1. Introduce jquery and jquery.numscroll.js

<script src="Js/jquery - 1.10.2. Min. Js." " type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.numscroll.js" type="text/javascript" charset="utf-8"></script>
Copy the code

2. Copy the following layout

<p><span id="num0"></span></p>
<p><span id="num1"></span></p>
<p><span id="num2"></span></p>
Copy the code

3. Create a NumScroll object

$(function() {
	//num0
	var num0 = 893689,addNum0,newNum0;
	$('#num0').text(num0);
	setInterval(function() {
		addNum0 = Math.random()*1000;
		newNum0 = parseInt(num0) + parseInt(addNum0);
		num0 = newNum0;
		$('#num0').numScroll({
			number: newNum0
		})
	}, 1500)
	
	//num1
	var num1 = 893623.89,addNum1,newNum1;
	$('#num1').text(num1);
	setInterval(function() {
		addNum1 = Math.random()*1000;
		newNum1 = (parseFloat(num1) + parseFloat(addNum1)).toFixed(2);
		num1 = newNum1;
		$('#num1').numScroll({
			number: newNum1
		})
	}, 1500)
	
	//num2
	var num2 = '893692813.89',addNum2,newNum2;
	$('#num2').text(num2);
	setInterval(function() {
		addNum2 = Math.random()*10000;
		newNum2 = (parseFloat(num2) + parseFloat(addNum2)).toFixed(2);
		num2 = newNum2;
		$('#num2').numScroll({
			number: newNum2,
			symbol: true})},1800)})Copy the code

Support parameters

Optional parameters The default value instructions
number 0 According to the value
step 1 Step length
time 2000 Limit time (not limit when null)
delay 0 Delayed start
symbol false Whether to display the separator separators
fromZero true Whether to start counting from 0 (if no, start counting from original value)