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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                click the red boxes to open / close each section

<div class="icons">
  <div class="icon">
    <div class="svg"></div>
    <span>Test Icon1</span>
    <div>
      <h2>Header Test1</h2>
      <ul>
        <li><span>Testing</span></li>
        <li><span>Testing.</span></li>
        <li><span>Testing</span></li>
      </ul>
    </div>
  </div>
  
  <div class="icon">
    <div class="svg"></div>
    <span>Test Icon2</span>
    <div>
      <h2>Header Test2</h2>
      <ul>
        <li><span>Testing</span></li>
        <li><span>Testing.</span></li>
        <li><span>Testing</span></li>
      </ul>
    </div>
  </div>
  
  
  <div class="icon">
    <div class="svg"></div>
    <span>Test Icon</span>
    <div>
      <h2>Header Test3</h2>
      <ul>
        <li><span>Testing</span></li>
        <li><span>Testing.</span></li>
        <li><span>Testing</span></li>
      </ul>
    </div>
  </div>
              
            
!

CSS

              
                .icon{
width: 30%;
text-align: center;
color: #333;
left: 0px;
display: inline;
float: left;
margin: 0px 0px 4% 2.5%;position:absolute
}
.icon:nth-of-type(1){
top:2em;left:0;
}
.icon:nth-of-type(2){
top:2em;left:33%;
}
.icon:nth-of-type(3){
top:2em;left:65%;
}
.svg {
  cursor:pointer;
  width:100px;
  height:200px;
  background-color:red;
  float:left;
  z-index:100;
}

.icon div h2 {
opacity:0;
}
.icon ul {

}
.icon span {
  opacity:0;
}
.icon li {


  color:#3688BC;
  font-size:90%;
  position:relative;
  list-style:none;
}
.icon li span{
color:#666
}

.icon div:nth-of-type(2) {
  margin-left:100px;
}
              
            
!

JS

              
                var tl = new TimelineLite();
tl.timeScale(2)
var open = false;


//https://greensock.com/forums/topic/11255-finding-and-animating-clicked-childs-name-within-parent-class/


$(".svg").click(function(){

  
    
    //clear the timeline and add new tweens to it.
    tl.clear();

    var siblings = $(this).parent().siblings();
    var me = $(this);
    var myParent = me.parent();
    console.log("open is ", open)
    if(!open) {
      open = true;
      
      //move the siblings out ot the way and open the one you clicked on
      
      tl.to(siblings, 1, {left:"+=200"})
        .to(siblings, 1, {left:"-10%"})
        .add("me")
        .to(myParent, 1, {left:"33%"})
        .to(me, 1, {scale:1.2}, "me")
        .to(myParent.find("span"), 1, {opacity:1}, "me+=0.2")
        .to(myParent.find("h2"), 1, {opacity:1}, "me+=0.2")
        .staggerFromTo(myParent.find("li"), 0.5, {left:-50, opacity:0}, {left:0, opacity:1}, 0.2);
    }else {
      open = false;
      
      //move the siblings back into view and close the item you clicked on
      
      $(".icon").each(function(index, element){
        tl.to(element, 1, {left:index * 33 + "%"}, 0)
          
      })
      tl.to(me, 1, {scale:1}, 0)
         .to(myParent.find("span"), 1, {opacity:0}, 0)
         .to(myParent.find("h2"), 1, {opacity:0}, 0)
         .staggerTo(myParent.find("li"), 0.5, {left:-50, opacity:0}, 0.2);
    }

  })


              
            
!
999px

Console