Home

Awesome

Vanilla JavaScript Tabs

Coverage Status Dependencies

Vanilla JavaScript Tabs - simple and awesome.

— Inspired by the blazing fast, lightweight, cross-platform and crazy popular Vanilla JS framework.

Demo

TABS

Options

OptionTypeDefaultDescription
elemstringHTML id of the tab container in the HTML markup.
opennumber0Opens this tab initially.

Methods

MethodTypeDescription
open(n)numberOpens a tab by index
update(n)numberUpdates 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

BrowserSupportDependencies
Chromeyes-
Firefoxyes-
Safariyes-
Operayes-
IE9 and upyes-

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.

Related