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

              
                <div class="caseStudyText">

  <div class="circle">
  </div>
  <div class="circle">
  </div>
  <div class="circle">
  </div>
  <div class="circle">
  </div>
  <div class="circle">
  </div>
  
</div>
              
            
!

CSS

              
                .circle {
  border: 1px red solid;
}

.caseStudyText {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 5em;
  
  div:nth-child(1) {
    position: absolute;
    top: 8%;
    left: 6%;
    width: 160px;
    height: 160px;
  }
  div:nth-child(2) {
    position: absolute;
    bottom: 15%;
    left: 24%;
    width: 96px;
    height: 96px;
  }
  div:nth-child(3) {
    position: absolute;
    bottom: 20%;
    left: 45%;
    width: 145px;
    height: 145px;
  }
  div:nth-child(4) {
    position: absolute;
    top: -5%;
    left: 68.25%;
    width: 119px;
    height: 119px;
  }
  div:nth-child(5) {
    position: absolute;
    bottom: 12%;
    left: 68%;
    width: 190px;
    height: 190px;
  }
  div:nth-child(6) {
    position: absolute;
    bottom: 20%;
    left: 45%;
    width: 145px;
    height: 145px;
  }
}
              
            
!

JS

              
                var circles = document.getElementsByClassName('circle'), //homepage circles to expand on hover
numCircles = circles.length,
timelines = [];

// Filling tl array with tl for each circle
for (var i = 0; i < numCircles; i += 1) {
  createTimeline(i);
  assignListeners(i);
}

//function for each circle to tween size
function createTimeline(i) {
  var timeline = new TimelineMax({ paused: true });
  timeline.to(circles[i], 0.6, {
   scale:2,
    transformOrigin: "50% 50%",
    ease: Expo.easeInOut
  }, 0)
  timelines[i] = timeline;
}

//circle event listeners
function assignListeners(i) {
  (function(i) {
    circles[i].addEventListener('mouseenter', function(e) {
      expand(e, i);
    }, false);
    circles[i].addEventListener('mouseleave', function(e) {
      contract(e, i);
    }, false);
  }(i));
}

//play circle timeline on hover
function expand(e, i) {
  timelines[i].play();
}

//reverse circle timeline on leave
function contract(e, i) {
  timelines[i].reverse();
}
              
            
!
999px

Console