Vanilla JavaScript tabs - tiny and simple.

Overview

Vanilla JavaScript Tabs

Build Status 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

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
(useful when dynamically adding tabs)
destroy() Removes the listeners

Usage example

var tabs = new 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.

Related

You might also like...

A jQuery tabs module for todays web!

tabulous.js A jQuery tabs module for todays web! Documentation Tabulous.js can be used with any contents you choose in the tabs and it couldn't be mor

Dec 4, 2022

jQuery tabs plugin

jQuery tabs plugin

English description | Описание на русском jQuery tabs plugin. Easy and well done tabs with many options and skin support Version: 1.0.2 Project page a

Nov 27, 2022

Responsive Tabs is a jQuery plugin that provides responsive tab functionality.

Responsive Tabs is a jQuery plugin that provides responsive tab functionality. The tabs transform to an accordion when it reaches a CSS breakpoint. You can use this plugin as a solution for displaying tabs elegantly on desktop, tablet and mobile.

Dec 8, 2022

Save resources by suspending unused tabs after 20 min.

Tab Suspender [WIP] Save resources by suspending unused tabs after 20 min. Instalation Enable Epiphany extension. Optional if not done. Download the l

May 7, 2022

Chrome style tab-resizing for jQuery UI tabs

stretchy tabs Chrome style tab-resizing for jQuery UI tabs stretchy tabs provides methods for adding and removing tabs ##Initialize stretchy tabs $( "

Nov 19, 2021

Bootstrap 4 stylesheet that implements vertically-oriented navigation tabs.

Bootstrap 4 stylesheet that implements vertically-oriented navigation tabs.

Responsive Vertical Navigation Tabs for Boostrap 4 New! 💥 If you use Bootstrap 5, a new package is available for that: bootstrap-5-vertical-tabs A st

Aug 4, 2022

A block preview that directly displays the block fields, including tabs.

A block preview that directly displays the block fields, including tabs.

Kirby Block Preview Fields This plugin for Kirby 3 displays the block fields directly in the block preview, including tabs. Inspired by the Kirby Fiel

May 10, 2023

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js

This is a vanilla Node.js rest API created to show that it is possible to create a rest API using only vanilla Node.js. But in most cases, I would recommend you to use something like Express in a production project for productivity purposes.

Jul 19, 2022

Tiny JavaScript library (1kB) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.

Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.

Nov 8, 2022
Comments
  • Wrong openTab Default?

    Wrong openTab Default?

    So, line #20 of vanilla-js-tabs.js says openTab = options.open || 1. I'm no JS expert, but it seems that it should be openTab = options.open || 0. Unless I change the 1 to a 0, it appears to be impossible to set open in the initialization script to the first tab, either by setting it's value to 0 or by simply not setting it. If I don't set it, it ends up selecting the second tab as the default.

    Should I be creating a PR for this?

    opened by calebgrove 2
  • wrong link to css in dist/index.html

    wrong link to css in dist/index.html

    Hi, I found bug in file dist/index.html at line 6: <link rel="stylesheet" href="vanilla-js-dropdown.css"> should be : <link rel="stylesheet" href="vanilla-js-tabs.css">

    opened by KamQuoss 1
  • Bad Example Code

    Bad Example Code

    On http://zoltantothcom.github.io/vanilla-js-tabs/, you have var tabs = new Tab({... in the example where it should be var tabs = new Tabs({.

    BTW, thanks for this little library, it's exactly what I was looking for. :)

    opened by calebgrove 1
  • Does not work if there is some markup inside title links

    Does not work if there is some markup inside title links

    If the markup of the links in the tabs header is something like this (p.e.):

        <ul class="js-tabs__header">
            <li><a href="#" class="js-tabs__title"><span class="tab-icon">icon1</span><span class="tab-title">Title 1</span></a></li>
            <li><a href="#" class="js-tabs__title"><span class="tab-icon">icon2</span><span class="tab-title">Title 2</span></a></li>
            <li><a href="#" class="js-tabs__title"><span class="tab-icon">icon3</span><span class="tab-title">Title 3</span></a></li>
            <li><a href="#" class="js-tabs__title"><span class="tab-icon">icon4</span><span class="tab-title">Title 4</span></a></li>
        </ul>
    

    Then it doesn't work properly because of the onClick function, changing it to this solves the problem (briefly tested):

        function onClick(e) {
            let titleItem = e.target.closest('.' + titleClass);
            if (titleItem === null) return;
            e.preventDefault();
            openTab(titleItem.getAttribute('data-index'));
        }
    

    Thank you for this simple and effective library.

    opened by santiago-ervina 0
Owner
Zoltan Toth
Zoltan Toth
jQuery Tabs Plugin. CSS Tabs with Accessible and Responsive Design. Lot of Tab Themes with Vertical and Horizontal Orientation.

Macaw Tabs Macaw Tabs is jQuery tabs plugin. It helps you to create accessible and responsive jQuery tabs by implementing the W3 design patterns for t

HTMLCSSFreebies 6 Dec 8, 2022
jQuery plugin to show a tabs bar for navigation. The tabs can be defined once, and shared across multiple HTML pages.

jquery.simpletabs v1.2.3 The jquery.simpletabs plugin shows a tabs bar for navigation. The tabs can be defined once, and shared across multiple HTML p

Peter Thoeny 1 Feb 23, 2022
Easy responsive tabs - is a lightweight jQuery plugin which optimizes normal horizontal or vertical tabs to accordion on multi devices

Easy responsive tabs - is a lightweight jQuery plugin which optimizes normal horizontal or vertical tabs to accordion on multi devices like: web, tablets, Mobile (IPad & IPhone). This plugin adapts the screen size and changes its action accordingly.

Samson Onna 600 Dec 8, 2022
Responsive tabs-to-accordion script without jQuery, written using pure JavaScript

vanilla-tabs Responsive tabs-to-accordion script without jQuery, written using pure JavaScript Author Dmytro Kudleichuk LinkedIn GitHub Online Demo Se

Dmitriy Kudleichuk 7 Dec 20, 2022
A tiny utility library to generate mesh gradient based on 4 RGB colors, built with vanilla js.

MeshGradient.js mesh-gradient.js is tiny utility library to generate mesh gradient based on 4 RGB colors, built with vanilla js. Installation! npm ins

Anup Aglawe 7 Jan 4, 2023
BCash is an app to help you keep track of who you owe and who owes you money in an easy way. Split your tabs and more.

BCash BCash is an app to help you keep track of who you owe and who owes you money in an easy way. Split your tabs and more. Routes for develpment: lo

Cuitlahuac Maldonado 3 Aug 11, 2022
⚡Chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of scope" from #HackerOne #Bugcrowd #Intigriti ...

FastDork v0.1 This chrome extension allows you to create lists of Google and Github dork to open multiple tabs with one click, import "scope/out of sc

skvndr 74 Dec 31, 2022
An Obsidian plugin that allows adding iframes with custom styling as editor tabs. Also comes with presets for Google Keep and more.

Obsidian Custom Frames An Obsidian plugin that turns web apps into panes using iframes with custom styling. Also comes with presets for Google Keep an

Ellpeck 208 Jan 8, 2023
Obsidian jTab adds the ability to show guitar chords and tabs directly in your notes.

Obsidian jTab Guide Obsidian jTab adds the ability to show guitar chords and tabs directly in your notes. It uses the jTab library to render the chord

David 24 Dec 25, 2022
Basic, accessible, responsive and freely restyleable tabs.

Skeletabs · Skeletabs is an open source jQuery plugin that provides tabbed browsing feature to your web contents. It is focused on accessibility and s

Taesung, Lim 18 Nov 13, 2022