:root{ --main-color: #B33771; } .counter{ color: var(--main-color); font-family: 'Dosis', sans-serif; text-align: center; width: 210px; height: 210px; padding: 80px 15px 20px; margin: 0 auto; border-radius: 50%; position: relative; z-index: 1; border: 5px dotted var(--main-color); box-shadow: 0 0 20px -5px var(--main-color); } .counter:before{ content: ''; border-radius: inherit; border: 3px solid var(--main-color); position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px; z-index: -1; } .counter .counter-icon{ color: #fff; background: var(--main-color); font-size: 30px; line-height: 60px; width: 60px; height: 60px; margin: 0 0 15px; border-radius: 50%; position: absolute; left: 0; top: 0; } .counter h3{ font-size: 18px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin: 0 0 12px; } .counter .counter-value{ font-size: 30px; font-weight: 600; display: block; } .counter.blue{ --main-color: #1B9CFC; } .counter.purple{ --main-color: #3B3B98; } .counter.pink{ --main-color: #FC427B; } @media screen and (max-width:990px){ .counter{ margin-bottom: 40px; } }
$(document).ready(function(){ $('.counter-value').each(function(){ $(this).prop('Counter',0).animate({ Counter: $(this).text() },{ duration: 3500, easing: 'swing', step: function (now){ $(this).text(Math.ceil(now)); } }); }); });