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

              
                    <ul class="tabs">
      <li class="tabs__item color1">
        <h2>Tony<span>Romo</span></h2>
        <p class="tabs__num">9</p>
        <p class="tabs__stats">
          Height: 6-2, Weight: 230, College: Eastern Illinois
        </p>
      </li>
      <li class="tabs__item color2">
        <h2>Aaron<span>Rodgers</span>
        </h2>
        <p class="tabs__num">12</p>
        <p class="tabs__stats">
          Height: 6-2, Weight: 225, College: California
        </p>
      </li>
      <li class="tabs__item color3">
        <h2>Ben<span>Roethlisberger</span></h2>
        <p class="tabs__num">7</p>
        <p class="tabs__stats">
          Height: 6-5, Weight: 241, College: Miami, OH
        </p>
      </li>
      <li class="tabs__item color4">
        <h2>Peyton<span>Manning</span></h2>
        <p class="tabs__num">18</p>
        <p class="tabs__stats">
          Height: 6-5, Weight: 230, College: Tennessee
        </p>
      </li>
      <li class="tabs__item color5">
        <h2>Tom<span>Brady</span></h2>
        <p class="tabs__num">12</p>
        <p class="tabs__stats">
          Height: 6-4, Weight: 225, College: Michigan
        </p>
      </li>
      <li class="tabs__item color6">
        <h2>Drew<span>Brees</span></h2>
        <p class="tabs__num">9</p>
        <p class="tabs__stats">
          Height: 6-0, Weight: 209, College: Purdue 
        </p>
      </li>
      <div class="views-toggle views-toggle--hidden">
        <svg fill="white" viewBox="0 0 24 24">
         <path d="M16.59 8.59l-4.59 4.58-4.59-4.58-1.41 1.41 6 6 6-6z"/>
        <path d="M0 0h24v24h-24z" fill="none"/>
      </svg>
      </div>
    </ul>

              
            
!

CSS

              
                * {
  box-sizing: border-box;
}

$color1: #5271C2;
$color2: #35a541;
$color3: #bdb235;
$color4: #db6623;
$color5: #3e5eb3;
$color6: #aa9e5c;

@mixin cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

@mixin easeOut {
  transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

@function longshadow($color_a,$color_b,$stepnum, $opacity: 1){
	$gradient_steps: null;
	@for $i from 1 through $stepnum {
		$weight: ( ( $i - 1 ) / $stepnum ) * 100;
		$colour_mix: mix($color_b, rgba($color_a, $opacity), $weight);
		$seperator: null;
		@if($i != $stepnum){ 
			$seperator: #{','}; 
		}
		$gradient_steps: append( #{$gradient_steps}, #{$i}px #{$i}px $colour_mix $seperator );
 }
  @return $gradient_steps;
}

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Montserrat';
  background: lighten(black, 10);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.tabs {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  
  &__item {
    will-change: transform, opacity, box-shadow;
    @include cover;
    margin-bottom: 50px;
    z-index: 1;
    padding: 0 50px;
    color: white;
    box-shadow: 0 30px 60px rgba(0,0,0,0);
    transform-origin: center 5%;
    overflow: hidden;
    @include easeOut;
    
    h2 {
      margin-top: 24px;
      font-size: 16px;
      line-height: 1;
      span {
        display: block;
        font-size: 36px;
      }
    }
  }
  
  &__num {
    text-align: center;
    font-size: 200px;
    font-weight: 700;
    margin: 0;
  }
  
  &__stats {
    text-align: center;
    font-size: 14px;
    margin: 25px 0 0;
    font-weight: 700;
  }
}

.views-toggle {
  position: absolute;
  top: 25px;
  right: 50px;
  width: 40px;
  height: 40px;
  z-index: 10;
  cursor: pointer;
  @include easeOut;
  transition-duration: .3s;
  visibility: visible;
  opacity: 0.6;
  
  &--hidden {
    opacity: 0;
    visibility: hidden;
    z-index: 0;
  }
  
  &:hover {
    opacity: 1;
  }
}

.color1 {
  background: $color1;
  
  .tabs__num {
     text-shadow: longshadow(darken($color1, 15%),$color1,100, 0.7);
    }
}
.color2 {
  background: $color2;
  
  .tabs__num {
     text-shadow: longshadow(darken($color2, 15%),$color2,100, 0.7);
    }
}
.color3 {
  background: $color3;
  
  .tabs__num {
     text-shadow: longshadow(darken($color3, 15%),$color3,100, 0.7);
    }
}
.color4 {
  background: $color4;
  .tabs__num {
     text-shadow: longshadow(darken($color4, 15%),$color4,100, 0.7);
    }
}
.color5 {
  background: $color5;
  
  .tabs__num {
     text-shadow: longshadow(darken($color5, 15%),$color5,100, 0.7);
    }
}
.color6 {
  background: $color6;
  
  .tabs__num {
     text-shadow: longshadow(darken($color6, 15%),$color6,100, 0.7);
    }
}

@media screen and (max-width: 600px) {
  .tabs__item {
    
    h2 span {
      font-size: 24px;
    }
  }
  
  .tabs__num {
    font-size: 120px;
  }
}
              
            
!

JS

              
                var Tabs = (function() {

  var toggler = $('.views-toggle');
  var tabs 		= $('li.tabs__item');
  var toggled = false;
  
  var transform = function(el, value) {
    el.css('transform', value);
    el.css('-webkit-transform', value);
    el.css('-ms-transform', value);
  };
   var transition = function(el, value) {
    el.css('transition', value);
    el.css('-webkit-transition', value);
    el.css('-ms-transition', value);
  };
  
  var moveContent = function() {
    if (!toggled) {
      toggled = true;
    } else {
      toggled = false;
    }
    
    moveTabs(toggled);
  
    return false;
  };
  
  var moveTabs = function(a) {
    var transY, scale;
    
    if (a) {
      tabs.css({
        'opacity': '1',
        'box-shadow': '0 30px 60px rgba(0,0,0,0.4)',
        'cursor': 'pointer'
      });
     
      tabs.each(function(index) {
        transY 	= index * 10;        
        scale		= 0.5 + index/25;
        
        transform($(this), 'translate3d(0,' + transY + 'vh, 0) scale(' + scale + ')');
      });
      
      toggler.addClass('views-toggle--hidden');
    } else {
      transform(tabs, 'translate3d(0,0,0) scale(1)');
    }
  };
  
  var switchTabs = function() {
    var selected = $(this);
    var others = selected.siblings('li');
    
    if (toggled) {
      transition(others, 'transform 0.3s cubic-bezier(0.755, 0.05, 0.855, 0.06)');
      transform(others, 'translate3d(0, 100%, 0) scale(1)');
      transform(selected, 'translate3d(0,0,0) scale(1)');
      tabs.css({
        'box-shadow': '0 30px 60px rgba(0,0,0,0.4)',
        'cursor': 'default'
      });
      toggled = false;

      selected.on('transitionend webkitTransitionend', function() {
        toggler.removeClass('views-toggle--hidden');
        others.css({
          'opacity': '0'
        });
        transform(others, 'translate3d(0, 100%, 0) scale(0)');
        transition(others, 'transform 0.9s cubic-bezier(0.23, 1, 0.32, 1)');
        selected.off('transitionend webkitTransitionend');
      });
    }
  };
  
  var setup = function() {
    toggled = true;
    moveTabs(toggled);
  };

  var init = function() {
    $(document).on('ready', setup);
		toggler.on('click touchstart', moveContent);
    tabs.on('click touchstart', switchTabs);
  };
  
  return {
    init: init
  };
  
}());

Tabs.init();
              
            
!
999px

Console