Awesome
Vanilla JavaScript Tabs
Vanilla JavaScript Tabs - simple and awesome.
— Inspired by the blazing fast, lightweight, cross-platform and crazy popular Vanilla JS framework.
Demo
Options
Option | Type | Default | Description |
---|---|---|---|
elem | string | HTML id of the tab container in the HTML markup. | |
open | number | 0 | Opens this tab initially. |
Methods
Method | Type | Description |
---|---|---|
open(n) | number | Opens a tab by index |
update(n) | number | Updates the tabs with n-th tab open<br />(useful when dynamically adding tabs) |
destroy() | Removes the listeners |
Usage example
var tabs = Tabs({
elem: "tabs",
open: 1,
});
// Open any other tab
tabs.open(3);
Running the tests
npm test
Browser support and dependencies
Browser | Support | Dependencies |
---|---|---|
Chrome | yes | - |
Firefox | yes | - |
Safari | yes | - |
Opera | yes | - |
IE9 and up | yes | - |
License
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
See Unlicense for full details.