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

              
                <h1>
  How much should I charge for my 
  <span id="flipper" class='flip'>
    <span class="step step0 set">template?</span>
    <span class="step step1">eBook?</span>
    <span class="step step2">web service?</span>
    <span class="step step3">another?</span>
    <span class="step step4">otro?</span>
    <span class="step step5">sick yet?</span>
    <span class="step step6">continue?</span>
  </span>
</h1>

<button class="next">next &rarr;</button>
              
            
!

CSS

              
                @import "compass/css3";

body {
  margin: 150px;
  background: #fff;
}

h1 {
  font-family: "Proxima Nova", "Helvetica Neue";
  font-weight: 200;
  color: #444;
  
  .flip {
    display: inline-block;
    //border: 1px solid red;
    position: relative;

    width: 200px;
    height: 40px;
    position: relative;
    top: 10px;
    
    @include perspective(500);
    @include transition(all .3s ease-in-out);
    
    
    span {
      font-weight:600;
      display: block;
      width: auto;
      //border:1px solid lightgreen;
       @include transition(all .3s ease-in-out);
      opacity: 0;
      @include transform-origin(0%, 0%);
      @include transform(rotateX(90deg)); 
      
      position: absolute;
      top: -20px;
      left: 0;
      
      &.set {
        top: 0;
        opacity: 1;
        @include transform-origin(0%, 0%);
        @include transform(rotateX(0deg)); 
      } 
      
      &.down {
        top: 40px;
        opacity: 0;
        @include transform-origin(0%, 0%);
        @include transform(rotateX(-90deg)); 
      }
           
    }
  }
}
              
            
!

JS

              
                class Flip
  constructor: (@el) ->
    @el = $(@el)
    @currentStep = 0;
    console.log("Created new Flip")
    
    $('.next').on 'click', $.proxy(@next, this)
    
  next: (event) ->
    if event
      event.preventDefault()
    
    nextStepNum   = @currentStep + 1
    currentStepEl = @el.find ".step#{@currentStep}"
    nextStepEl    = @el.find ".step#{nextStepNum}"
    
    if nextStepEl.length
      console.log('we found the next step', nextStepEl)
      
      currentStepEl.prev().removeClass 'down'
      
      currentStepEl.removeClass 'set'
      currentStepEl.addClass 'down'
      
      nextStepEl.addClass 'set'
      nextStepEl.removeClass 'down'
      
      nextStepEl.next().removeClass 'down'
      @currentStep++
      
    else
      # reset to 0
      @el.find(".step").removeClass('set');
      @el.find(".step#{@currentStep}").addClass('down');
      @el.find(".step").not(".step#{@currentStep}").removeClass('down');
      
      @currentStep = -1
      @next()
    
  
$ ->
  f = new Flip(document.getElementById('flipper'))
  setInterval ( -> 
    f.next()  
  ), 1500
              
            
!
999px

Console