Copy HTML <div class="vertical-tabs-container"> <div class="vertical-tabs"> <a href="javascript:void(0)" class="js-vertical-tab vertical-tab is-active" rel="tab1">Item 1</a> <a href="javascript:void(0)" class="js-vertical-tab vertical-tab" rel="tab2">Item 2</a> <a href="javascript:void(0)" class="js-vertical-tab vertical-tab" rel="tab3">Item 3</a> <a href="javascript:void(0)" class="js-vertical-tab vertical-tab" rel="tab4">Item 4</a> </div> <div class="vertical-tab-content-container"> <a href="" class="js-vertical-tab-accordion-heading vertical-tab-accordion-heading is-active" rel="tab1">Item 1</a> <div id="tab1" class="js-vertical-tab-content vertical-tab-content"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras tincidunt pellentesque lorem, id suscipit dolor rutrum id. Morbi facilisis porta volutpat. Fusce adipiscing, mauris quis congue tincidunt, sapien purus suscipit odio, quis dictum odio tortor in sem. Ut sit amet libero nec orci mattis fringilla. Praesent eu ipsum in sapien tincidunt molestie sed ut magna. Nam accumsan dui at orci rhoncus pharetra tincidunt elit ullamcorper. Sed ac mauris ipsum. Nullam imperdiet sapien id purus pretium id aliquam mi ullamcorper.</p> </div> <a href="" class="js-vertical-tab-accordion-heading vertical-tab-accordion-heading" rel="tab2">Item 2</a> <div id="tab2" class="js-vertical-tab-content vertical-tab-content"> <p>Ut laoreet augue et neque pretium non sagittis nibh pulvinar. Etiam ornare tincidunt orci quis ultrices. Pellentesque ac sapien ac purus gravida ullamcorper. Duis rhoncus sodales lacus, vitae adipiscing tellus pharetra sed. Praesent bibendum.</p> </div> <a href="" class="js-vertical-tab-accordion-heading vertical-tab-accordion-heading" rel="tab3">Item 3</a> <div id="tab3" class="js-vertical-tab-content vertical-tab-content"> <p>Donec mattis mauris gravida metus laoreet non rutrum sem viverra. Aenean nibh libero, viverra vel vestibulum in, porttitor ut sapien. Phasellus tempor lorem id justo ornare tincidunt. Nulla faucibus, purus eu placerat fermentum, velit mi iaculis nunc, bibendum tincidunt ipsum justo eu mauris. Nulla facilisi. Vestibulum vel lectus ac purus tempus suscipit nec sit amet eros. Nullam fringilla, enim eu lobortis dapibus, quam magna tincidunt nibh, sit amet imperdiet dolor justo congue turpis.</p> </div> <a href="" class="js-vertical-tab-accordion-heading vertical-tab-accordion-heading" rel="tab4">Item 4</a> <div id="tab4" class="js-vertical-tab-content vertical-tab-content"> <p>Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus dui urna, mollis vel suscipit in, pharetra at ligula. Pellentesque a est vel est fermentum pellentesque sed sit amet dolor. Nunc in dapibus nibh. Aliquam erat volutpat. Phasellus vel dui sed nibh iaculis convallis id sit amet urna. Proin nec tellus quis justo consequat accumsan. Vivamus turpis enim, auctor eget placerat eget, aliquam ut sapien.</p> </div> </div> </div>

Copy Scss .vertical-tabs-container { $base-border-color: gainsboro !default; $base-border-radius: 3px !default; $base-background-color: white !default; $base-line-height: 1.5em !default; $base-spacing: 1.5em !default; $action-color: #477dca !default; $dark-gray: #333 !default; $medium-screen: 40em !default; $base-font-color: $dark-gray !default; $tab-border-color: $base-border-color; $tab-border: 1px solid $tab-border-color; $tab-border-radius: $base-border-radius; $tab-content-background: lighten($tab-border-color, 10%); $tab-active-color: $tab-content-background; $tab-inactive-color: $base-background-color; $vertical-tabs-height: 18.75em; $vertical-tab-mode: $medium-screen; @include clearfix; border: $tab-border; border-radius: $tab-border-radius; margin-bottom: $base-spacing; overflow: hidden; li { list-style: none; } a { color: $action-color; text-decoration: none; } .vertical-tabs { display: none; @include media($vertical-tab-mode) { background-color: $tab-inactive-color; display: inline; float: left; height: $vertical-tabs-height; width: 20%; } } .vertical-tab { @include media($vertical-tab-mode) { border-bottom: $tab-border; display: block; font-weight: bold; margin-right: -1px; padding: ($base-spacing / 2) ($gutter / 2); &.is-active { background-color: $tab-content-background; margin-right: -1px; } } } a.vertical-tab-accordion-heading, a.vertical-tab { color: $dark-gray; } .vertical-tab:focus { outline: none; } .vertical-tab-content-container { display: block; margin: 0 auto; & a:focus { outline: none; } @include media($vertical-tab-mode) { @include size(80%, $vertical-tabs-height); background-color: $tab-content-background; display: inline-block; } } .vertical-tab-content { background-color: $tab-content-background; padding: $base-spacing $gutter; p { color: $base-font-color; line-height: $base-line-height; } @include media($vertical-tab-mode) { border: 0; display: none; } } .vertical-tab-accordion-heading { background-color: $tab-inactive-color; border-top: $tab-border; cursor: pointer; display: block; font-weight: bold; padding: $base-spacing / 2 $gutter / 2; &:focus, &:hover { color: $action-color; } &:first-child { border-top: 0; } &.is-active { background: $tab-active-color; border-bottom: 0; } @include media($vertical-tab-mode) { display: none; } } } // Based on code by Jett Miller jettmiller.net

Copy JavaScript Copy CoffeeScript $(".js-vertical-tab-content").hide(); $(".js-vertical-tab-content:first").show(); /* if in tab mode */ $(".js-vertical-tab").click(function(event) { event.preventDefault(); $(".js-vertical-tab-content").hide(); var activeTab = $(this).attr("rel"); $("#"+activeTab).show(); $(".js-vertical-tab").removeClass("is-active"); $(this).addClass("is-active"); $(".js-vertical-tab-accordion-heading").removeClass("is-active"); $(".js-vertical-tab-accordion-heading[rel^='"+activeTab+"']").addClass("is-active"); }); /* if in accordion mode */ $(".js-vertical-tab-accordion-heading").click(function(event) { event.preventDefault(); $(".js-vertical-tab-content").hide(); var accordion_activeTab = $(this).attr("rel"); $("#"+accordion_activeTab).show(); $(".js-vertical-tab-accordion-heading").removeClass("is-active"); $(this).addClass("is-active"); $(".js-vertical-tab").removeClass("is-active"); $(".js-vertical-tab[rel^='"+accordion_activeTab+"']").addClass("is-active"); });