"State Number Counter"
Bootstrap 4.1.1 Snippet by sumi9xm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<div class="container">
<div class="stat">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="milestone-counter">
<i class="fa fa-user fa-3x"></i>
<span class="stat-count highlight">122</span>
<div class="milestone-details">Happy Customers</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="milestone-counter">
<i class="fa fa-coffee fa-3x"></i>
<span class="stat-count highlight">100</span>
<div class="milestone-details">Ordered Coffee's</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="milestone-counter">
<i class="fa fa-trophy fa-3x"></i>
<span class="stat-count highlight">140</span>
<div class="milestone-details">Awards Win</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
<div class="milestone-counter">
<i class="fa fa-camera fa-3x"></i>
<span class="stat-count highlight">500</span>
<div class="milestone-details">Photos Taken</div>
</div>
</div>
</div><!-- stat -->
</div>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.milestone-counter {
float: left;
margin: 25px;
text-align: center;
}
.stat {
margin:10px auto;
}
.highlight {
color:#111;
padding:20px 0;
font-weight:bold;
display:block;
overflow:hidden;
margin-bottom:0;
font-size:48px;
}
.stat i {
color: #3498db;
}
.milestone-details {
font-weight:bold;
font-size:18px;
color:#999;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
(function($) {
"use strict";
function count($this){
var current = parseInt($this.html(), 10);
current = current + 1; /* Where 50 is increment */
$this.html(++current);
if(current > $this.data('count')){
$this.html($this.data('count'));
} else {
setTimeout(function(){count($this)}, 50);
}
}
$(".stat-count").each(function() {
$(this).data('count', parseInt($(this).html(), 10));
$(this).html('0');
count($(this));
});
})(jQuery);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments: