4.0.3 • Published 4 months ago

@wearediagram/wsol.tabs v4.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Tabs

Content tabs that toggle content when clicked.

Installation

Install via Bower:

$ bower install websolutions/tabs --save

Usage

The most basic example follows this DOM structure:

<div class="tabs">
  <ul class="tab-navigation">
    <li class="selected">
      <a href="#tab1">Tab Title 1</a>
    </li>
    <li>
      <a href="#tab2">Tab Title 2</a>
    </li>
  </ul>
  <div class="tab-container">
    <div id="tab1">
      <h3>Tab Title 1</h3>
      <p>Tab Content 1</p>
    </div>
    <div id="tab2" class="hidden">
      <h3>Tab Title 2</h3>
      <p>Tab Content 2</p>
    </div>
  </div>
</div>

And is initialized like so:

$(".tabs").wsol_tabs();

The plugin can also be removed afterwards:

$(".tabs").data("wsol.tabs").destroy();

Or manually changed to a specific tab (index or ID):

$(".tabs").data("wsol.tabs").changeTab(0);

Configuring

The jQuery plugin supports a number of configuration options:

OptionTypeDescriptionDefault
navigationLinkSelectorStringSelector for tab navigation links> .tab-navigation > li > a
containerSelectorStringSelector for tab containers> .tab-container > div
selectedClassStringClass name to apply to the selected tab linkselected
hiddenClassStringClass name to apply to non-selected tabshidden
accordionHiddenClassStringClass name to apply to non-selected accordionsaccordion-hidden
autoScrollBooleanKeep active tab/accordion in viewport on changetrue
4.0.3

4 months ago

4.0.2

5 months ago

4.0.1

2 years ago

4.0.0

2 years ago

3.1.4

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago