"Bootstrap 4 counter"
Bootstrap 4.1.1 Snippet by dkstudio

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 ---------->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container">
<div class="row">
<br/>
<div class="col text-center">
<h2>Bootstrap 4 counter</h2>
<p>counter to count up to a target number</p>
</div>
</div>
<div class="row text-center">
<div class="col">
<div class="counter">
<i class="fa fa-code fa-2x"></i>
<h2 class="timer count-title count-number" data-to="100" data-speed="1500"></h2>
<p class="count-text ">Our Customer</p>
</div>
</div>
<div class="col">
<div class="counter">
<i class="fa fa-coffee fa-2x"></i>
<h2 class="timer count-title count-number" data-to="1700" data-speed="1500"></h2>
<p class="count-text ">Happy Clients</p>
</div>
</div>
<div class="col">
<div class="counter">
<i class="fa fa-lightbulb-o fa-2x"></i>
<h2 class="timer count-title count-number" data-to="11900" data-speed="1500"></h2>
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
26
27
28
.counter {
background-color:#f5f5f5;
padding: 20px 0;
border-radius: 5px;
}
.count-title {
font-size: 40px;
font-weight: normal;
margin-top: 10px;
margin-bottom: 0;
text-align: center;
}
.count-text {
font-size: 13px;
font-weight: normal;
margin-top: 10px;
margin-bottom: 0;
text-align: center;
}
.fa-2x {
margin: 0 auto;
float: none;
display: table;
color: #4ad1e5;
}
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
26
27
28
29
30
31
32
33
34
35
36
37
(function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(this).data('speed'),
refreshInterval: $(this).data('refresh-interval'),
decimals: $(this).data('decimals')
}, options);
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(settings.speed / settings.refreshInterval),
increment = (settings.to - settings.from) / loops;
// references & variables that will change with each update
var self = this,
$self = $(this),
loopCount = 0,
value = settings.from,
data = $self.data('countTo') || {};
$self.data('countTo', data);
// if an existing interval can be found, clear it first
if (data.interval) {
clearInterval(data.interval);
}
data.interval = setInterval(updateTimer, settings.refreshInterval);
// initialize the element with the starting value
render(value);
function updateTimer() {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Related: See More


Questions / Comments:

How it can be managed for decimal numbers?

deepankermanna (1) - 4 years ago - Reply 1


How can I add text after counter finished? ie 100 % or 34 +

lfokp (-1) - 5 years ago - Reply -1


You can add any class name to your counter class eg: <h2 class="timer count-title count-number plus-sign"

Then add the below CSS code in your stylesheet for before or after:

.plus-sign:before {

content: "+";

}

.satis:after {

content: "+";

}

vahe-hass () - 4 years ago - Reply 0


How it can be managed for decimal numbers?

deepankermanna (1) - 4 years ago - Reply 0


Can you plase tell me how it can be managed for decimal numbers?

deepankermanna (1) - 4 years ago - Reply 0


HI. can you plz tell me how it can be managed for decimal numbers?

deepankermanna (1) - 4 years ago - Reply 0


HI.. can you plz tell me how it can be managed for decimal numbers

deepankermanna (1) - 4 years ago - Reply 0


HI.. can yu plz tell me how it can be managed for decimal numbers

deepankermanna (1) - 4 years ago - Reply 0