Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <section class="loader">
  <section class="pull-left">
    <div class="circle static-circle"></div>
  </section>
  
  <div class="circle counter counter-1"></div>
  <div class="circle counter counter-2"></div>
  <div class="circle counter counter-3"></div>
  
  <section class="pull-right">
    <div class="circle static-circle"></div>
  </section>
</section>
              
            
!

CSS

              
                html
  background: #333
  
.loader
  width: 400px
  margin: 5% 10% 0
  position: relative

.pull-left
  float: left
    
  
.pull-right
  float: right
  .circle
    transform: scale(.4)

.circle
  height: 100px
  width: 100px
  border-radius: 50%
  background: pink
  transition: transform 0.8s ease
  box-shadow: 0 0 3px 1px lighten(pink,30)
  position: absolute
  z-index: 1
  &.counter
    height: 40px
    width: 40px
    background: pink
    top: 30px
    left: 30px
    z-index: 0
    transition: transform 1s ease
    transform: scale(1,.1)
              
            
!

JS

              
                var loader_width = 400,
    right_outside = loader_width+60,
    right_inside = loader_width+25,
    left_outside = -15,
    left_inside = 30,
    i=1,
    circle_diameter_right = $('.pull-right .static-circle').height(),
    circle_diameter_left = $('.pull-left .static-circle').height();

setInterval(function(){
  if(i <= 3){
    // First 3 move right
    moveRight(i);
  }else if(i >= 4 && i <= 6){
    // Second 3 move left
    moveLeft(i);
  }else if(i >= 7){
    // at 7 reset and then move right
    i=1;
    moveRight(i);
  }
}, 1500);

function moveRight(val){
  // transform left static-circle smaller as circles leave
  if(i === 1){
    $('.pull-left .static-circle').css({
      'transform': 'scale(.8)'
    });
  }else if(i === 2){
    $('.pull-left .static-circle').css({
      'transform': 'scale(.6)'
    });
  }else if(i === 3){
    $('.pull-left .static-circle').css({
      'transform': 'scale(.4)'
    });
  }
  
  // increase the size of the counter-circle as it moves across
  $('.counter-'+i).css({
    'transform':'scale(1,1.2)'
  });
  
  $('.counter-'+i).animate({
    // animate moving to the far right
    left: right_outside
  }, 800, function(){
    // center the counter-cirlce on the right static-circle
    $('.counter-'+i).animate({
      left: right_inside
    }, 200);
    
    // increase the size of the static circle as the counter cirlces are added
    if(i === 1){
      $('.pull-right .static-circle').css({
        'transform': 'scale(.6)'
      });
    }else if(i === 2){
      $('.pull-right .static-circle').css({
        'transform': 'scale(.8)'
      });
    }else if(i === 3){
       $('.pull-right .static-circle').css({
        'transform': 'scale(1)'
      });
    }
    
    // decrease the size of the counter-circle (prep for moving back)
    $('.counter-'+i).css({
      'transform':'scale(1,.1)'
    });
    
    i++;
  });
}

function moveLeft(val){
  // only want a count of 1-3 for finding counter circle numbers
  if(i>=4){
    i-=3;
  }
  
  // transform left static-circle smaller as circles leave
  if(i === 1){
    $('.pull-right .static-circle').css({
      'transform': 'scale(.8)'
    });
  }else if(i === 2){
    $('.pull-right .static-circle').css({
      'transform': 'scale(.6)'
    });
  }else if(i === 3){
    $('.pull-right .static-circle').css({
      'transform': 'scale(.4)'
    });
  }
  
  // increase the size of the counter-circle as it moves across
  $('.counter-'+i).css({
    'transform':'scale(1,1.2)'
  });
  
  $('.counter-'+i).animate({
    // animate moving to the far left
    left: left_outside
  }, 800, function(){
    // center the counter-cirlce on the left static-circle
    $('.counter-'+i).animate({
      left: left_inside
    }, 200);
    
    // increase the size of the static circle as the counter cirlces are added
    if(i === 1){
      $('.pull-left .static-circle').css({
        'transform': 'scale(.6)'
      });
    }else if(i === 2){
      $('.pull-left .static-circle').css({
        'transform': 'scale(.8)'
      });
    }else if(i === 3){
      $('.pull-left .static-circle').css({
        'transform': 'scale(1)'
      });
    }
    
    // decrease the size of the counter-circle (prep for moving back)
    $('.counter-'+i).css({
      'transform':'scale(1,.1)'
    });
    
    i+=4;
  });
}
              
            
!
999px

Console