Couters

  • STEPS

    1. html

    
                      
    
                      <div class="container">
          <div class="row">
              <div class="col-md-3 col-sm-6">
                  <div class="counter">
                      <div class="counter-icon"><i class="fa fa-globe"></i></div>
                      
                      <span class="counter-value">29</span> 
                      <h3>Nila</h3>
                  </div>
              </div>
              
          </div>
      </div>
    
    
    
                    

    2. css

    
    
    
                   
    :root{ --main-color: #01A99E; }
    .counter{
        color: #fff;
        background-color: var(--main-color);
        font-family: 'Raleway', sans-serif;
        width: 210px;
        padding: 30px 40px 30px 20px;
        margin: 0 auto;
        position: relative;
        z-index: 1;
        clip-path: polygon(0 0, 80% 0, 100% 50%, 80% 100%, 0 100%);
    }
    .counter:before,
    .counter:after{
        content: '';
        background-color: var(--main-color);
        height: 100%;
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        z-index: -1;
        clip-path: polygon(0 0, 80% 0, 100% 50%, 80% 100%, 0 100%);
    }
    .counter:before{
        background-color: #fff;
        width: calc(100% - 15px);
    }
    .counter:after{ width: calc(100% - 30px); }
    .counter .counter-icon{
        font-size: 35px;
        margin: 0 0 10px;
    }
    .counter h3{
        font-size: 15px;
        font-weight: 600;
        letter-spacing: 0.5px;
        text-transform: capitalize;
        margin: 0 0 5px;
    }
    .counter .counter-value{
        font-size: 35px;
        font-weight: 600;
    }
    .counter.yellow{ --main-color: #da8c34; }
    .counter.pink{ --main-color: #e84393; }
    .counter.green{ --main-color: #71bd55; }
    @media  screen and (max-width:990px){
        .counter{ margin-bottom: 40px; }
    }  
    
    

    3. script

    
    
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
      <script>
     $(document).ready(function(){
         $('.counter-value').each(function(){
             $(this).prop('Counter',0).animate({
                 Counter: $(this).text()
             },{
                 duration: 100,
                 easing: 'swing',
                 step: function (now){
                     $(this).text(Math.ceil(now));
                 }
             });
         });
     });
    </script>