jQuery-EasyTabs

Easy and flexible jQuery tabbed functionality without all the styling.

  • 所有者: JangoSteve/jQuery-EasyTabs
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

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

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.


Info

主要指標

概覽
名稱與所有者JangoSteve/jQuery-EasyTabs
主編程語言JavaScript
編程語言JavaScript (語言數: 2)
平台
許可證
所有者活动
創建於2010-08-24 04:37:49
推送於2018-08-13 09:11:18
最后一次提交2015-01-06 20:43:54
發布數18
最新版本名稱v3.2.0 (發布於 2013-05-09 17:51:04)
第一版名稱v2.0 (發布於 2010-10-29 03:28:57)
用户参与
星數550
關注者數34
派生數201
提交數111
已啟用問題?
問題數208
打開的問題數110
拉請求數7
打開的拉請求數10
關閉的拉請求數9
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?