Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="one"></div>
<div class="wrap">
  <aside class="achievements background-grey">
  <div class="container achievements__inner">
    <div class="achievements__item">
      <div class="item-title"><span class="counter" data-counttarget="900">0</span>+</div>
      <p class="item-descr">Successful Cloud Projects</p>
    </div>
    <div class="achievements__item">
      <div class="item-title"><span class="counter" data-counttarget="11">0</span></div>
      <p class="item-descr">AWS Competencies</p>
    </div>
    <div class="achievements__item">
      <div class="item-title"><span class="counter" data-counttarget="100">0</span>+</div> 
      <p class="item-descr">Technical AWS Certifications</p>
    </div>
    <div class="achievements__item"> 
      <div class="item-title"><span class="counter" data-counttarget="400">0</span>+</div> 
      <p class="item-descr">Customers</p> 
    </div>
  </div>
</aside>
  
</div>
<div class="two"></div>
              
            
!

CSS

              
                .achievements
  padding: 40px 80px

  &__inner
    display: flex
    // align-items: center
    // padding: 40px 80px
    padding-left: 80px
    padding-right: 80px

  &__item 
    width: 25%
    text-align: center

    .item-title 
      font-size: 76px
      font-weight: 600
      color: blue

    .item-descr 
      font-size: 24px
      font-weight: 500


@media (max-width: 1150px)
  .achievements
    padding: 60px 0 40px 0

    &__inner
      flex-wrap: wrap
      padding-left: 25px
      padding-right: 25px

    &__item 
      width: 50%
      padding-left: 5px
      padding-right: 5px
      margin-bottom: 40px

    .item 
      &-title 
        font-size: 70px

      &-descr
        font-size: 20px


@media (max-width: 440px)
  .achievements
    &__item 
      width: 100%
      
      
.one 
  height: 1000px
  
.two 
  height: 1000px
              
            
!

JS

              
                
var fired = 0;
window.addEventListener('scroll', function() {
  var temp = document.querySelector('.achievements').getBoundingClientRect().top;
  // console.log('page y =' + window.pageYOffset + 'coord = ' + temp);
  
  if (fired == 0) {
    var achievements = document.querySelector('.achievements');
    var achievementsCoordinates = achievements.getBoundingClientRect().top;
  
    if (achievementsCoordinates < 100){
      const counters = document.querySelectorAll('.counter');
      const speed = 300;

      counters.forEach( counter => {
        const animate = () => {
          const value = +counter.getAttribute('data-counttarget');
          const data = +counter.innerText;
          const time = value / speed;
          if(data < value) {
            counter.innerText = Math.ceil(data + time);
            setTimeout(animate, 1);
          }else{
            counter.innerText = value;
          }
        }
        animate();
      });
       
      fired = true;
    }   

  };
                        

});


              
            
!
999px

Console