cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

            
              .tabs
  .tabs-header
    .border
    ul
      li.active: a(href='#tab-1'
                   tab-id='1'
                   ripple
                   ripple-color='#FFF') Tab 1
      li: a(href='#tab-2'
            tab-id='2'
            ripple
            ripple-color='#FFF') Tab 2
      li: a(href='#tab-3'
            tab-id='3'
            ripple
            ripple-color='#FFF') Tab 3
      li: a(href='#tab-4'
            tab-id='4'
            ripple
            ripple-color='#FFF') Tab 4
      li: a(href='#tab-5'
            tab-id='5'
            ripple
            ripple-color='#FFF') Tab 5
    nav.tabs-nav
      i.material-icons#prev(ripple
                            ripple-color='#FFF') &#xE314;
      i.material-icons#next(ripple
                            ripple-color='#FFF') &#xE315;
  .tabs-content
    .tab.active(tab-id='1')
      | 1. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Ellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor.
    .tab(tab-id='2')
      | 2. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam.
    .tab(tab-id='3')
      | 3. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor.
    .tab(tab-id='4')
      | 4. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Aenean lacinia bibendum nulla sed consectetur.
    .tab(tab-id='5')
      | 5. Donec ullamcorper nulla non metus auctor fringilla. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Curabitur blandit tempus porttitor.Cras mattis consectetur purus sit amet fermentum. Maecenas sed diam eget risus varius blandit sit amet non magna. Nullam quis risus eget urna mollis ornare vel eu leo. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Maecenas sed diam eget risus varius blandit sit amet non magna. Maecenas sed diam eget risus varius blandit sit amet non magna. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Vestibulum id ligula porta felis euismod semper. Aenean lacinia bibendum nulla sed consectetur. Donec id elit non mi porta gravida at eget metus. Donec id elit non mi porta gravida at eget metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Aenean lacinia bibendum nulla sed consectetur. Maecenas faucibus mollis interdum. Donec ullamcorper nulla non metus auctor fringilla. Aenean lacinia bibendum nulla sed consectetur. Aenean lacinia bibendum nulla sed consectetur.
.pen-footer
  a(href='https://www.behance.net/gallery/31103291/Tabs-UI-Library'
    target='_blank')
    i.material-icons arrow_backward
    | View on Behance
  a(href='https://github.com/andyhqtran/UI-Library/tree/master/Tabs'
    target='_blank')
    | View on Github
    i.material-icons arrow_forward
            
          
!
            
              // Font Family
$body-font: "Roboto";

// Font Weights
$thin: 100;
$light: 300;
$regular: 400;
$semibold: 500;
$bold: 700;
$ultra: 800;

// Base Font
$base-font-family: $body-font, sans-serif;
$base-font-size: 14px;
$base-font-weight: $regular;
$base-line-height: 1.6em;

// Colors
$black: #000000;
$dark-gray: rgba($black, 0.8);
$gray: rgba($black, 0.6);
$light-gray: rgba($black, 0.4);
$lighter-gray: rgba($black, 0.2);
$white: #FFFFFF;
$accent: #4285F4;
$primary: #2F313A;
$secondary: #F4B142;

// Form Settings
$max-width: 600px;
$max-height: 400px;
$gutters: 24px;

html {
  width: 100%;
  height: 100%;
}

body {
  background: linear-gradient(45deg,  rgba(66, 183, 245,0.8) 0%,rgba(66, 245, 189,0.4) 100%);
  color: $gray;
  font-family: $base-font-family;
  font-size: $base-font-size;
  line-height: $base-line-height;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

// Ripple
[ripple] {
  z-index: 1;
  position: relative;
  overflow: hidden;

  .ripple {
    position: absolute;
    background: $white;
    width: 12px;
    height: 12px;
    border-radius: 100%;
    animation: ripple 1.6s;
  }
}

@keyframes ripple {
  0% {
    transform: scale(1);
    opacity: 0.2;
  }

  100% {
    transform: scale(40);
    opacity: 0;
  }
}

.tabs {
  z-index: 15px;
  position: relative;
  background: $white;
  width: $max-width;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba($black, 0.1);
  box-sizing: border-box;
  margin: 100px auto 10px;
  overflow: hidden;

  // Tabs Header
  &-header {
    position: relative;
    background: $accent;
    overflow: hidden;

    // Border
    .border {
      position: absolute;
      bottom: 0;
      left: 0;
      background: $secondary;
      width: auto;
      height: 2px;
      transition: 0.3s ease;
    }

    // List
    ul {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      width: calc(100% - 68px);
    }

    // List Item
    li {
      transition: 0.3s ease;
    }

    // Anchor
    a {
      z-index: 1;
      display: block;
      box-sizing: border-box;
      padding: 15px 20px;
      color: $white;
      font-weight: $semibold;
      text-decoration: none;
      text-transform: uppercase;
    }
  }

  // Tabs Nav
  &-nav {
    position: absolute;
    top: 0;
    right: 0;
    background: $accent;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 10px;
    color: $white;
    user-select: none;

    // Fade
    &:before {
      content: '';
      z-index: 1;
      position: absolute;
      top: 0;
      left: 0;
      height: 100%;
      box-shadow: 0 0 20px 10px $accent;
    }

    // Arrows
    i {
      border-radius: 100%;
      cursor: pointer;
    }
  }

  // Tabs Content
  &-content {
    position: relative;
    padding: 15px 20px;
    transition: 0.3s ease;
    overflow: hidden;

    // Blurred Text Effect
    &:after {
      content: '';
      position: absolute;
      bottom: -1px;
      left: 0;
      display: block;
      width: 100%;
      height: 1px;
      box-shadow: 0 0 20px 10px $white;
    }

    // Tab
    .tab {
      display: none;

      // Active
      &.active {
        display: block;
      }
    }
  }
}

// Pen Footer
.pen-footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: $max-width;
  margin: 20px auto 100px;

  a {
    color: $white;
    font-size: 12px;
    text-decoration: none;
    text-shadow: 1px 2px 0 rgba($black, .1);
    
    .material-icons {
      width: 12px;
      margin: 0 5px;
      vertical-align: middle;
      font-size: 12px;
    }
  }
}

.cp-fab {
  background: $white !important;
  color: $accent !important;
}
            
          
!
            
              $(document).ready(function () {

  // Intial Border Position
  var activePos = $('.tabs-header .active').position();

  // Change Position
  function changePos() {

    // Update Position
    activePos = $('.tabs-header .active').position();

    // Change Position & Width
    $('.border').stop().css({
      left: activePos.left,
      width: $('.tabs-header .active').width()
    });
  }

  changePos();

  // Intial Tab Height
  var tabHeight = $('.tab.active').height();

  // Animate Tab Height
  function animateTabHeight() {

    // Update Tab Height
    tabHeight = $('.tab.active').height();

    // Animate Height
    $('.tabs-content').stop().css({
      height: tabHeight + 'px'
    });
  }

  animateTabHeight();

  // Change Tab
  function changeTab() {
    var getTabId = $('.tabs-header .active a').attr('tab-id');

    // Remove Active State
    $('.tab').stop().fadeOut(300, function () {
      // Remove Class
      $(this).removeClass('active');
    }).hide();

    $('.tab[tab-id=' + getTabId + ']').stop().fadeIn(300, function () {
      // Add Class
      $(this).addClass('active');

      // Animate Height
      animateTabHeight();
    });
  }

  // Tabs
  $('.tabs-header a').on('click', function (e) {
    e.preventDefault();

    // Tab Id
    var tabId = $(this).attr('tab-id');

    // Remove Active State
    $('.tabs-header a').stop().parent().removeClass('active');

    // Add Active State
    $(this).stop().parent().addClass('active');

    changePos();

    // Update Current Itm
    tabCurrentItem = tabItems.filter('.active');

    // Remove Active State
    $('.tab').stop().fadeOut(300, function () {
      // Remove Class
      $(this).removeClass('active');
    }).hide();

    // Add Active State
    $('.tab[tab-id="' + tabId + '"]').stop().fadeIn(300, function () {
      // Add Class
      $(this).addClass('active');

      // Animate Height
      animateTabHeight();
    });
  });

  // Tab Items
  var tabItems = $('.tabs-header ul li');

  // Tab Current Item
  var tabCurrentItem = tabItems.filter('.active');

  // Next Button
  $('#next').on('click', function (e) {
    e.preventDefault();

    var nextItem = tabCurrentItem.next();

    tabCurrentItem.removeClass('active');

    if (nextItem.length) {
      tabCurrentItem = nextItem.addClass('active');
    } else {
      tabCurrentItem = tabItems.first().addClass('active');
    }

    changePos();
    changeTab();
  });

  // Prev Button
  $('#prev').on('click', function (e) {
    e.preventDefault();

    var prevItem = tabCurrentItem.prev();

    tabCurrentItem.removeClass('active');

    if (prevItem.length) {
      tabCurrentItem = prevItem.addClass('active');
    } else {
      tabCurrentItem = tabItems.last().addClass('active');
    }

    changePos();
    changeTab();
  });

  // Ripple
  $('[ripple]').on('click', function (e) {
    var rippleDiv = $('<div class="ripple" />'),
      rippleOffset = $(this).offset(),
      rippleY = e.pageY - rippleOffset.top,
      rippleX = e.pageX - rippleOffset.left,
      ripple = $('.ripple');

    rippleDiv.css({
      top: rippleY - (ripple.height() / 2),
      left: rippleX - (ripple.width() / 2),
      background: $(this).attr("ripple-color")
    }).appendTo($(this));

    window.setTimeout(function () {
      rippleDiv.remove();
    }, 1500);
  });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console