// @page Pattern Library/JavaScript // @name Tabs // // @description // These are the basic tabs used for landing pages. You can either reference a data-target for the urls or href for the target tabs. They have a non-js fallback and fold over to accordion when in small tablet view. They are initialised on page load if the tabs classes exist. // // @javascript // var tabs = new Tabs({ // tabContainer: ".us-tabs", // tabLinks: ".us-tabs-nav-mainlink", // tabTitle: "us-tab-title", // activeClass: "active", // changeUrls: true, // collapsible: true, // autoScroll: false // }); // // @markup //
// //
//
//

// // Test 1 // // //

//
//

Fatback capicola leberkas pork loin pork jowl. Meatloaf shoulder pancetta, salami prosciutto ribeye andouille chuck landjaeger short loin filet mignon sirloin. Pork chop tri-tip ham pork hamburger frankfurter leberkas short ribs biltong. Prosciutto ham hock rump, andouille tongue flank sirloin tri-tip ball tip frankfurter ham drumstick meatloaf pork loin.

//
//
//
//

// // Test 2 // // //

//
//

Kielbasa tenderloin spare ribs, andouille doner brisket chuck drumstick bresaola short loin pork t-bone ground round jowl. Ball tip pork loin doner tongue filet mignon biltong hamburger leberkas. Filet mignon kielbasa kevin short ribs, drumstick chuck shankle spare ribs tri-tip.

//
//
//
//

// // Test 3 // // //

//
//

Pig pastrami pork loin kielbasa, filet mignon meatloaf short ribs tenderloin. Pork loin leberkas kevin fatback porchetta bresaola. Cow rump shoulder pastrami. Andouille pork belly t-bone short ribs brisket. Bresaola pork belly tail salami capicola meatball. Pork belly beef ham landjaeger.

//
//
//
//
$tab-width: col-width(2) !default; $tab-border-color: #fff; $tab-active-color: $tab-border-color; @keyframes tab-show { 0% { opacity: 0; } 100% { opacity: 1; } } // Tab nav .us-tabs-nav { display: none; background-color: $c-super-light-grey; @include respond-to(tablet) { .js & { display: block; } } @if $media-query-legacy-support { .js.ie8 & { display: block; } } } .us-tabs-nav-wrapper { @extend %container; } .us-tabs-nav-menu { display: table; display: -webkit-flex; display: flex; width: 100%; overflow: hidden; flex-flow: row; } .us-tabs-nav-link { display: table-cell; width: $tab-width; padding: 14px 1em 12px; text-align: center; vertical-align: middle; border-right: 3px solid $tab-border-color; border-radius: 0; transition: none; text-decoration: none; @include respond-to(tablet) { font-size: em(14px); line-height: 1.25em; } @include respond-to(desktop) { font-size: em($base-font-size); } @include respond-to(large-desktop) { font-size: em(18px); } &:last-child { border-right: 0; } &:hover, &.active { color: $c-uswitch-navy; border-right: 0; &:before { background-color: $c-uswitch-navy; } } &.active { cursor: default; background-color: $tab-active-color; &:hover { background-color: $tab-active-color; } } } .us-tabs-nav-mainlink { @include link-colors($c-darker-grey, $c-uswitch-navy, $c-uswitch-navy, $c-darker-grey); position: relative; background-color: $c-super-light-grey; transition: color 300ms, background-color 300ms; &:before { position: absolute; top: 0; right: 0; left: 0; height: 5px; background-color: $c-super-light-grey; content: ""; transition: background-color 300ms; } &:hover { background-color: #f4f5f6; } &:hover .us-tabs-nav-chevron, &:hover .us-tabs-nav-chevron-wrapper .us-icon, .us-tab.active & .us-tabs-nav-chevron, .us-tab.active & .us-tabs-nav-chevron-wrapper .us-icon { transform: rotate(-90deg); fill: $c-uswitch-navy; } &:hover:before { background-color: $c-uswitch-navy; } } .us-tab.active { .us-tabs-nav-mainlink:before { background-color: $c-uswitch-navy; } } // scss-lint:disable Comment, MergeableSelector .us-tabs-nav-link { /* autoprefixer: off */ display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center; -ms-flex-align: center; -ms-flex-pack: center; -webkit-align-items: center; align-items: center; } // scss-lint:enable Comment, MergeableSelector // Tabs .us-tabs-container { @extend %container; @include respond-to(to-tablet) { padding: 0; } } .us-tab-title { @include heading(4); position: relative; margin: 0; font-weight: normal; border-bottom: 1px solid #fff; @include respond-to(tablet) { .js & { display: none; } } @if $media-query-legacy-support { .js.ie8 & { display: none; } } .us-tabs-nav-mainlink { display: block; padding: .75em ($gutter-width / 2) .5em; .us-tab.active & { color: $c-uswitch-navy; background-color: $tab-active-color; } } .us-tabs-nav-chevron, .us-tabs-nav-chevron-wrapper .us-icon { position: absolute; right: ($gutter-width / 2); transform: rotate(90deg); transition: transform .2s ease; } } .us-tab-content { display: block; overflow: hidden; opacity: 1; @include respond-to(to-tablet) { padding-right: ($gutter-width / 2); padding-left: ($gutter-width / 2); } .js & { max-height: 0; @include respond-to(tablet) { display: none; max-height: none; } } @if $media-query-legacy-support { .ie8.js & { display: none; max-height: none; } } .us-tab.active & { max-height: 9999px; padding-top: 1em; @include respond-to(tablet, true) { display: block; animation-duration: 1s; animation-name: tab-show; animation-fill-mode: forwards; } } }