Easy and flexible jQuery tabbed functionality without all the styling.

Overview

JQuery EasyTabs Plugin

Tabs with(out) style.

EasyTabs creates tabs with all the functionality, no unwanted changes to your markup, and no hidden styling.

Unlike jQuery UI tabs, which style and arrange your tabs and panels for you, this plugin handles only the functionality of the tabs. By leaving the styling and layout up to you, it is much easier to style and arrange your tabs the way you want.

What EasyTabs Does:

  • Creates tabs from an unordered list, which link to divs on the page
  • Allows complete customization of appearance, layout, and style via CSS
  • Supports forward- and back-button in browsers
  • Tabs are bookmarkable and SEO-friendly
  • Tabs can be cycled at a specified interval

What EasyTabs Does NOT Do:

  • Style your tabs in any way (though sensible CSS defaults can be found in the demos)

Show Your Support

Show your support for jQuery EasyTabs, by helping us raise money for the Karmanos Cancer Institute. Click here to lend your support to: Karmanos Cancer Institute by Alfa Jango and make a donation at www.pledgie.com !

Documentation

  • Installation
  • Stylization
  • Configuration Options
  • Demos

Installation

The HTML

Unlike JQuery UI tabs, the HTML markup for your tabs and content can be arranged however you want. At the minimum, you need a container, an unordered list of links for your tabs, and matching divs for your tabbed content.

<div id="tab-container">
  <ul>
    <li><a href="#tab-1-div">Tab 1</a></li>
    <li><a href="#that-other-tab">The Second Tab</a></li>
    <li><a href="#lastly">Tab C</a></li>
  </ul>
  <div id="tab-1-div">
    <h2>Heading 1</h2>
    <p>This is the content of the first tab.</p>
  </div>
    <div id="that-other-tab">
    <h2>Heading 2</h2>
    <p>Stuff from the second tab.</p>
  </div>
  <div id="lastly">
    <h2>Heading 3</h2>
    <p>More stuff from the last tab.</p>
  </div>
</div>

The Javascript

To enable back- and forward-button support for the users' browsers, be sure to include either the jQuery HashChange plugin (recommended) or the Address plugin before including the EasyTabs plugin. There is no other configuration required, it will just work!

<script src="/javascripts/jquery.js" type="text/javascript"></script> 
<script src="/javascripts/jquery.hashchange.js" type="text/javascript"></script> 
<script src="/javascripts/jquery.easytabs.js" type="text/javascript"></script>  

<script type="text/javascript"> 
  $(document).ready(function(){ $('#tab-container').easytabs(); });
</script> 

I varied the tab ids and names just to show you how flexible this is. There is no magic going on with this plugin; it's not trying to guess the order of your tabs or what tab is associated with which <div>. Just make the id of the content <div> match the href of the tab link.

Required Markup

The only rules you need to follow are these:

  • containing <div> with a unique id
  • the container <div> contains an unordered list <ul> of links <a>

(UPDATE: As of version 1.1, this is no longer the case. You can now include your tabs anywhere within the container. It can be a <ul>, <ol>, <div>, or anything you want. The default is still a top-level <ul>, so to change it you just specify your selector with the new "tabs" option.)

  • the container div also contains content divs (for the tabbed content), each div has a unique id that matches the href property of a link in the unordered list

Other than that, go nuts. The order of the elements does NOT matter. Your <ul> could be before or after the content divs (or even between them). You can put non-tabbed content between the elements. It doesn't matter. The most common structure (for inspiration's sake) is something like this:

div#tab-container ul > ( li > a[href="tab-1"], li > a[href="second-tab"] )
div#tab-container div#tab-1
div#tab-container div#second-tab

+---------------------------------------------------------------------------+
|                              div#tab-container                            |
|  +---------------------------------------------------------------------+  |
|  |                                  ul                                 |  |
|  |  +-----------------------------+    +----------------------------+  |  |
|  |  |             li              |    |             li             |  |  |
|  |  |  +-----------------------+  |    |  +----------------------+  |  |  |
|  |  |  |    a[href="tab-1"]    |  |    |  | a[href="second-tab"] |  |  |  |
|  |  |  +-----------------------+  |    |  +----------------------+  |  |  |
|  |  +-----------------------------+    +----------------------------+  |  |
|  +---------------------------------------------------------------------+  |
|                                                                           |
|  +---------------------------------------------------------------------+  |
|  |                               div#tab-1                             |  |
|  +---------------------------------------------------------------------+  |
|                                                                           |
|  +---------------------------------------------------------------------+  |
|  |                             div#second-tab                          |  |
|  +---------------------------------------------------------------------+  |
|                                                                           |
+---------------------------------------------------------------------------+

For stylization, configuration options, and live demos, see the EasyTabs homepage.


Links

Info

Comments
  • Content nested in divs not recognized - how to get around?

    Content nested in divs not recognized - how to get around?

    First off: Thanks for this great script - have it working in a static HTML template, does a real fine job!

    I´m currently trying to implement Easytabs using Wordpress (childtheme of Genesis) and widget areas for the content. The scripts are loaded fine and in the source I can see that the job is done, but the problem is the following: The hashtag in the menu are set to rows (#row-1). The rows contain several divs (example: div id="row_1", section id="text-2", div class="widget-wrap", actual content - see source). URL: removed after closing the issue (playground, not really styled yet)

    It seems the content is not recognized at all therefore. Script error: TypeError: y.match(...) is null I tried all the ID´s down to text-2 (no script error then, but not working), still no luck (background images and padding is displayed). Is there a way around it (or am I doing something wrong)? I´d really appreciate any help, thanks in advance!

    opened by gsibergerin 33
  • Loading tab content via Ajax

    Loading tab content via Ajax

    Hi,

    A quick clarification - in the standard UI tabs, setting an href value on the tab link will allow the tab content to be loaded via ajax. The homepage for this project indicates that it has all the functionality of the ui tabs, but also specifies that it does not do ajax loading.

    Thus, my question is, if I drop this in place of my normal UI tabs, which load with ajax, will it break the ajax loading? If so, is there any workaround for this?

    Thanks for any assistance! Henry.

    opened by htowens 23
  • Nested Tabs

    Nested Tabs

    [Moved to new issue]

    Is it possible to nest sets of easytabs? E.g. I want to have my main tabs, and some subtabs in each of the main tabs, which can also load content via ajax.

    I tried a simple nesting by simply putting a second set of tabs within the layout of the page being loaded by the main tab (with different container div ids), but I got some unexpected behaviour, such as the main set of tabs trying to load content that should have been loaded by the subtabs, which makes me think it maybe wasn't designed to be used in this way.

    opened by htowens 18
  • Page Jump

    Page Jump

    Hello,

    I love the EasyTabs plug-in. Very clean and simple. I am having an issue though with the page jumping to the top (like an anchor) when clicked.

    Please find the live example here:

    http://unicef.milestone-creative.com/natcom-donor-toolkits/toolkit.php

    Select any of the tabs (Toolkit Document, Results Matrix, Budget, etc.) you will find the issue.

    Thank you in advance to your attention to this matter.

    Carl

    opened by cavidano 11
  • Multi-tabs with history

    Multi-tabs with history

    Hey,

    I was wondering if there is a way to have multiple tabs on a page, whether they are nestled or standalone on the page, but with history enabled, similar to jQuery BBQ but to have customised hashtags?

    Thanks, James

    opened by ghost 11
  • next previous tab switch

    next previous tab switch

    Thank you once again for creating this great plugin, have used it quite extensively. And also for adding the ajax functionality recently.

    Ok this should be something that I have overlooked somewhere, but I have been trying to implement forward/next backwards/previous buttons that update dynamically

    I know in ui-tabs I can go

    $(function() {var $tabs = $('#tabs').tabs();
    
    $(".ui-tabs-panel").each(function(i){
    
      var totalSize = $(".ui-tabs-panel").size() - 1;
    
      if (i != totalSize) {
          next = i + 2;
          $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page »</a>");
      }
    
      if (i != 0) {
          prev = i;
          $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>« Prev Page</a>");
      }
    
    });
    
    $('.next-tab, .prev-tab').click(function() {
           $tabs.tabs('select', $(this).attr("rel"));
           return false;
       });});
    

    How would I go about doing this with easytabs thank you in advance and keep up the great work

    opened by fb-BG 11
  • When the Easy Tab will works with latest jQuery 1.8?

    When the Easy Tab will works with latest jQuery 1.8?

    Hi, I have use jQuery 1.8 in my site. But the Easy Tab plugin does not works in the jQuery 1.8 version. It works in jQuery 1.7. When we will get latest plugin works with latest jQuery?

    opened by miraz235 9
  • Weird issue on IE7 when animation is on

    Weird issue on IE7 when animation is on

    I love Easy Tabs and it works fine in al lbrowsers except IE7. I have found that when the animation is on (default fadein/out) the tab changes, the old one fades out, the new ones fades in...and then fades out again leaving a blank tab!

    This doesn't happen when the animation is off and also I can't see it happening on the demo page. I use the next and prev button script too.

    What do you think is gogin on? Why would the tab change and then disappear?

    opened by babyewok 9
  • Collapsable option?

    Collapsable option?

    I would like to see some added extra functionality ala ui-tabs Collapsable option

    So along the lines of this demo http://jqueryui.com/demos/tabs/collapsible.html

    more info here http://jqueryui.com/demos/tabs/#collapsible and code here http://jqueryui.com/demos/tabs/#option-collapsible

    Although this needs to be tied in with the default open tab option

    eg you set the Collapsable option to true and do not supply a default tab number it will show all tabs collapsed

    Thanks

    opened by fb-BG 9
  • Using defaultTab only if there is a li with an id defaulttab - otherwise use the first one

    Using defaultTab only if there is a li with an id defaulttab - otherwise use the first one

    I'm using Easytabs on many pages of a huge website. Normally the first tag should be the first one active, but on a few pages we want to decide different tabs as the first once to show up. For that I've included " $('#tab-container').easytabs({defaultTab: '#defaultTab'});" teh default-Tab Code. But now the others don't work anymore. I could add to all the first tabs of all the easytabs the ID, but that would be a lot of work and there must be a more easier way ;) (well I hope so) . Do you have any idea for that? So if there is a li with the id defaultTab then use that one - if not just use the first one?

    Thanks Karo

    opened by karok 8
  • use easytabs and address together..

    use easytabs and address together..

    I've try to combine jQuery Addres and easytabs as one for getting results in side of the tab.

    http://www.asual.com/jquery/address/

    but i can't make it work it's not getting the tab name if there is more then one parameter.

    now it's like this: http://domain.com/pageName/#tabName

    there is a way to use something like that: http://domain.com/pageName/#tabName/#moredata

    OR: http://domain.com/pageName/#/tabName/moredata

    thanks in advance!

    opened by CBox 8
  • Tabs set to visibility:hidden and never changed

    Tabs set to visibility:hidden and never changed

    easytabs 3.2.0 is used on an intranet page that I was asked to fix. It looks like the script is setting visibility:hidden on the content divs at startup (around https://github.com/JangoSteve/jQuery-EasyTabs/blob/master/lib/jquery.easytabs.js#L614 ) and then that doesn't get removed when a tab is clicked. It's also set as a element style attribute, which is a nuisance to remove (js needed not mere css).

    Of course, this might be a usage error by the page author but I don't see how. Changing the visibility seems a bit like it contradicts the "[display] is the only property easytabs changes" in line 609, too.

    opened by mjray 0
  • Spans not fully supported

    Spans not fully supported

    Spans are shown to work on the advanced demo at https://os.alfajango.com/easytabs/#advanced-demo

    Using spans instead of list items with the selector tabs: "> div > span" does not show tab content correctly and produces a console error.

    Uncaught Error: The specified default tab ('li:first-child') could not be found in the tab set ('> ul > li') out of 0 tabs.

    opened by dovematrix 0
  • Add style file for plugin

    Add style file for plugin

    Hello Steve, I'm derek, In my case I use your plugin and create a scss file to use, Because on your project style code in the html, I'm not sure whether your need this request, just send this pr for you ^^

    opened by derekjian 0
  • Issues in firefox

    Issues in firefox

    Hi this is the website i am working on http://www.noor-azmi.com/element/projects.html

    in firefox when i click the "Project List" tab, the content is not inside the tab container.

    I tested in chrome, IE & safari and all works fine except firefox

    opened by imza86 1
  • easytabs:before not working

    easytabs:before not working

    Hi There ,

    in my script i used :

    var tabs = jQuery(".modal_tab_wrapper"); tabs.on("easytabs:before", function (e, clicked) { return false; });

    or even tried :

    $(function() { var tabs = jQuery(".jet_modal_tab_wrapper"); tabs.on("easytabs:before", function (e, clicked) { return false; }); });

    both of above is in jQuery(document).ready(function($)

    but none of working , i am still able to click on tab and it's not disabled . could anyon help ?

    Thanks .

    opened by jeni1616 0
Owner
Steve Schwartz
Owner @ Alfa Jango, CTO/co-founder @ Genomenon, former CTO/co-founder @ Carcode (acquired by Edmunds.com)
Steve Schwartz
jQuery easy ticker is a news ticker like plugin, which scrolls the list infinitely. It is highly customizable, flexible with lot of features and works in all browsers.

jQuery Easy Ticker plugin jQuery easy ticker is a news ticker like plugin which scrolls a list infinitely. It is highly customizable, flexible with lo

Aakash Chakravarthy 208 Dec 20, 2022
Lavalink client with lots of extra functionality, easy to use and well optimized.

?? nSysLava Lavalink client with lots of extra functionality, easy to use and well optimized! พัฒนาโดยคนไทย ?? Many utility functions - มีฟังก์ชันอรรถ

nicenathapong 3 Apr 12, 2022
JavaScript project for the Leaderboard list app, using Webpack and ES6 features, notably modules. this app consume the Leaderboard API using JavaScript async and await and add some styling.

Leaderboard Project JavaScript project for the Leaderboard list app, using Webpack and ES6 features, notably modules. this app consume the Leaderboard

bizimungu pascal 4 May 20, 2022
Complete, flexible, extensible and easy to use page transition library for your static web.

We're looking for maintainers! Complete, flexible, extensible and easy to use page transition library for your static web. Here's what's new in v2. Ch

null 3.7k Jan 2, 2023
Easy to use and flexible router for Alpine.js

alpinejs-router Easy to use and flexible router for Alpine.js Installation npm npm install @shaun/alpinejs-router yarn yarn add @shaun/alpinejs-router

Shaun 33 Dec 30, 2022
Erick Hans 5 Oct 26, 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
Basic styling to create calendar icons with pure HTML and CSS

Calendar Icon Basic styling to create calendar icons with pure HTML and CSS Usage Embed the CSS, and markup your date: <link type="text/css" rel="styl

null 1 Aug 23, 2022
Richard Chileya 5 Nov 11, 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.

Jelle Kralt 537 Dec 8, 2022
Accordion Slider is a jQuery plugin that combines the functionality of a slider with that of an accordion.

Accordion Slider - jQuery slider plugin A responsive and touch-enabled jQuery accordion slider plugin that combines the functionality of a slider with

null 0 Dec 29, 2022
jQuery plugin that combines the functionality of a grid with that of an accordion.

Grid Accordion - jQuery plugin A responsive and touch-enabled jQuery grid accordion plugin that combines the functionality of a grid with that of an a

null 1 Dec 16, 2022
Simple Cropper is a jQuery plugin which gives you ability to add cropping functionality to your web application

Simple Cropper is a jQuery plugin which gives you ability to add cropping functionality to your web application. It uses html5 canvas to create cropped images and css3, so it only works on latest browsers.

null 1 Feb 15, 2022
React components for the Infima styling framework.

React Infima React Infima provides React components for the Infima styling framework. It doesn't add any new features to Infima, it just ports the com

Uğur Eren 7 Sep 8, 2022
jQuery based scrolling Bar, for PC and Smartphones (touch events). It is modern slim, easy to integrate, easy to use. Tested on Firefox/Chrome/Maxthon/iPhone/Android. Very light <7ko min.js and <1Ko min.css.

Nice-Scrollbar Responsive jQuery based scrolling Bar, for PC and Smartphones (touch events). It is modern slim, easy to integrate, easy to use. Tested

Renan LAVAREC 2 Jan 18, 2022
An easy to implement marquee JQuery plugin with pause on hover support. I know its easy because even I can use it.

Simple-Marquee Copyright (C) 2016 Fabian Valle An easy to implement marquee plugin. I know its easy because even I can use it. Forked from: https://gi

null 16 Aug 29, 2022
Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party library!

PI Calculator Web JS (Online) Calculating Pi number without limitation until 10k digits or more in your browser powered by JS without any third party

Max Base 6 Jul 27, 2022
A simple Node.js code to get unlimited instagram public pictures by every user without api, without credentials.

Instagram Without APIs Instagram Scraping in August 2022, no credentials required This is a Node.js library, are you looking for the same in PHP? go t

Francesco Orsi 28 Dec 29, 2022
jquery-input-mask-phone-number.js - A simple, easy jquery format phone number mask library

jquery-input-mask-phone-number A jQuery Plugin to make masks on input field to US phone format. Quick start 1. Add latest jQuery and jquery-input-mask

Raja Rama Mohan Thavalam 12 Aug 25, 2022