2.3.2 • Published 3 years ago

c2-tabs v2.3.2

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

tabs

Accessible tabs, where aria states are automatically added.

To get Started

CommonJS

$ npm install c2-tabs
var Tabs = require('c2-tabs');

Browser Global

<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="iife/tabs.js"></script>

Options

OptionTypeDefault ValueInfo
tabliststring'.tablist'refers to the selector on the tablist
targetstring'.tab'refers to the selector on the tabs
panelstring'.panel'refers to the selector on the tab panels
prefixstring'Tabs-'sets the prefix for the aria label
hashEnabledbooleanfalseactivates tabs based on URL hash (also requires 'data-hash' attribute on each tab)
firstOpennumber0tab you want open on page load

API

var tabs = new Tabs('.Tabs');

tabs.on('update', i => {
    console.log('index', i); // index 0, index 1, index 0
});

tabs.activate(0); // activates tab with a specific index
tabs.activateNext();
tabs.activatePrevious();
tabs.destroy();

Accessibility

http://www.w3.org/TR/wai-aria-practices/#tabpanel

I left out the ctrl + pageup and ctrl + pagedown interactions, since those are already used to switch between browser tabs in Firefox and Chrome.

License

MIT © The C2 Group

2.3.2

3 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.0

7 years ago

2.0.0

8 years ago

1.1.0

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago