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="container">
  <div class="box">
    <div class="number1 is-active">1</div>
    <div class="number2">2</div>
    <div class="number3">3</div>
  </div>
  <div class="cards">
    <div class="card1 is-active">①</div>
    <div class="card2">②</div>
    <div class="card3">③</div>
  </div>
  
</div>
              
            
!

CSS

              
                .container {
  padding-top: 20px;
 width: 300px;
}

.box {
 display: flex;
 justify-content: center;
}

.number1,
.number2,
.number3{
 width: 50px;
 height: 50px;
 background-color: white;
  border-radius: 50%;
  border: 1px solid black;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.number2,
.number3{
  margin-left: 20px;
}


.number1.is-active,
.number2.is-active,
.number3.is-active {
  background-color: orange;
}


.cards {
  padding: 20px;
  text-align: center;
}

.card1,
.card2,
.card3 {
  font-size: 100px;
  opacity: 0;
  visibility: hidden;
  display: none;
}

.card1.is-active,
.card2.is-active,
.card3.is-active {
  display: block;
}
              
            
!

JS

              
                let card1 = document.querySelector('.card1');
let card2 = document.querySelector('.card2');
let card3 = document.querySelector('.card3');
let num1 = document.querySelector('.number1');
let num2 = document.querySelector('.number2');
let num3 = document.querySelector('.number3');

let tl1 = gsap.timeline();
let tl2 = gsap.timeline();
let tl3 = gsap.timeline();
let tl = gsap.timeline({
  repeat: -1
});

tl
.to(card1,{className:'card1 is-active'})
.to(card2,{className:'card2'},'<')
.to(card3,{className: 'card3'},'<')
.to(num1,{className: 'number1 is-active'},'<')
.to(num2,{className: 'number2'},'<')
.to(num3,{className: 'number3'},'<')
.to(card1,{autoAlpha:1})
.to(card1,{autoAlpha:0}, '+=3')

.to(card1,{className:'card1'})
.to(card2,{className:'card2 is-active'},'<')
.to(card3,{className: 'card3'},'<')
.to(num1,{className: 'number1'},'<')
.to(num2,{className: 'number2 is-active'},'<')
.to(num3,{className: 'number3'},'<')
.to(card2,{autoAlpha:1})
.to(card2,{autoAlpha:0}, '+=3')

 .to(card1,{className:'card1'})
.to(card2,{className:'card2'},'<')
.to(card3,{className: 'card3 is-active'},'<')
.to(num1,{className: 'number1'},'<')
.to(num2,{className: 'number2'},'<')
.to(num3,{className: 'number3 is-active'},'<')
.to(card3,{autoAlpha:1})
.to(card3,{autoAlpha:0}, '+=3')

num1.addEventListener('mouseover',function(){
  if(tl1.isActive()){
    return;
  }else{
    tl.pause();
    tl1
    .to(card1,{className:'card1 is-active'})
    .to(card2,{className:'card2'},'<')
    .to(card3,{className: 'card3'},'<')
    .to(num1,{className: 'number1 is-active'},'<')
    .to(num2,{className: 'number2'},'<')
    .to(num3,{className: 'number3'},'<')
    .fromTo(card1,{autoAlpha:0},{autoAlpha:1})
  }
})

num2.addEventListener('mouseover',function(){
  if(tl2.isActive()){
    return;
  }else{
    tl.pause();
    tl2
    .to(card1,{className:'card1'})
    .to(card2,{className:'card2 is-active'},'<')
    .to(card3,{className: 'card3'},'<')
    .to(num1,{className: 'number1'},'<')
    .to(num2,{className: 'number2 is-active'},'<')
    .to(num3,{className: 'number3'},'<')
    .fromTo(card2,{autoAlpha:0},{autoAlpha:1})
  }
})

num3.addEventListener('mouseover',function(){
  if(tl3.isActive()){
    return;
  }else{
    tl.pause();
    tl3
    .to(card1,{className:'card1'})
    .to(card2,{className:'card2'},'<')
    .to(card3,{className: 'card3 is-active'},'<')
    .to(num1,{className: 'number1'},'<')
    .to(num2,{className: 'number2'},'<')
    .to(num3,{className: 'number3 is-active'},'<')
    .fromTo(card3,{autoAlpha:0},{autoAlpha:1})
  }
})

num1.addEventListener('mouseleave',function(){
  tl.restart();
});

num2.addEventListener('mouseleave',function(){
  tl.restart();
});

num3.addEventListener('mouseleave',function(){
  tl.restart();
});



              
            
!
999px

Console