UNPKG

7.09 kBMarkdownView Raw
1# jQuery Smart Tab v3
2#### The flexible jQuery tab control plugin
3
4[![Build Status](https://travis-ci.org/techlab/jquery-smarttab.svg?branch=master)](https://travis-ci.org/techlab/jquery-smarttab)
5[![npm version](https://badge.fury.io/js/jquery-smarttab.svg)](https://badge.fury.io/js/jquery-smarttab)
6[![Latest Stable Version](https://poser.pugx.org/techlab/jquery-smarttab/v/stable)](https://packagist.org/packages/techlab/jquery-smarttab)
7[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/techlab/jquery-smarttab/master/LICENSE)
8[![Donate on Paypal](https://img.shields.io/badge/PayPal-dipuraj-blue.svg)](https://www.paypal.me/dipuraj)
9
10Smart Tab is a flexible and heavily customizable **jQuery Tab control plugin**.
11
12> If you think it is cool, you should also check it's sibling [React Smart Tab](http://techlaboratory.net/react-smarttab)
13
14+ [Homepage](http://techlaboratory.net/jquery-smarttab)
15+ [Documentation](http://techlaboratory.net/jquery-smarttab#documentation)
16+ [Demos](http://techlaboratory.net/jquery-smarttab#demo)
17+ [StackOverflow Q&A](http://stackoverflow.com/questions/tagged/smart-tab)
18+ [GitHub Issues](https://github.com/techlab/jquery-smarttab/issues)
19
20Demos
21-----
22 + [Basic Example](http://techlaboratory.net/projects/demo/jquery-smart-tab/v3)
23 + [Ajax Contents](http://techlaboratory.net/projects/demo/jquery-smart-tab/v3/ajax)
24 + [Multiple Tabs](http://techlaboratory.net/projects/demo/jquery-smart-tab/v3/multiple)
25
26Screenshots
27-----
28![jQuery Smart Tab default](http://techlaboratory.net/assets/media/jquery-smart-tab/smarttab-v3-default.png)
29
30![jQuery Smart Tab dark](http://techlaboratory.net/assets/media/jquery-smart-tab/smarttab-v3-dark.png)
31
32![jQuery Smart Tab tabs](http://techlaboratory.net/assets/media/jquery-smart-tab/smarttab-v3-tabs.png)
33
34![jQuery Smart Tab brick](http://techlaboratory.net/assets/media/jquery-smart-tab/smarttab-v3-brick.png)
35
36Requirements
37-----
38 + [jQuery](http://jquery.com/) (supports from jQuery-1.11.1+ to the latest jQuery-3.5.0)
39
40Installation
41-----
42
43### [NPM](https://www.npmjs.com/package/jquery-smarttab)
44 npm install jquery-smarttab
45
46### [Yarn](https://yarn.pm/jquery-smarttab)
47 yarn add jquery-smarttab
48
49### [Composer](https://packagist.org/packages/techlab/jquery-smarttab)
50 composer require techlab/jquery-smarttab
51
52### [CDN - jsDelivr](https://www.jsdelivr.com/package/npm/jquery-smarttab)
53```html
54<!-- CSS -->
55<link href="https://cdn.jsdelivr.net/npm/jquery-smarttab@3.1.1/dist/css/smart_tab_all.min.css" rel="stylesheet" type="text/css" />
56
57<!-- JavaScript -->
58<script src="https://cdn.jsdelivr.net/npm/jquery-smarttab@3.1.1/dist/js/jquery.smartTab.min.js" type="text/javascript"></script>
59```
60
61### [CDN - UNPKG](https://unpkg.com/browse/jquery-smarttab/)
62```html
63<!-- CSS -->
64<link href="https://unpkg.com/jquery-smarttab@3.1.1/dist/css/smart_tab_all.min.css" rel="stylesheet" type="text/css" />
65
66<!-- JavaScript -->
67<script src="https://unpkg.com/jquery-smarttab@3.1.1/dist/js/jquery.smartTab.min.js" type="text/javascript"></script>
68```
69
70### Download
71#### [Download from GitHub](https://github.com/techlab/jquery-smarttab/archive/master.zip)
72
73Features
74-----
75
76+ Responsive design
77+ Standalone CSS
78+ Bootstrap compatible
79+ Various themes included
80+ Customizable CSS
81+ Cool transition animations (fade/slide-horizontal/slide-vertical/slide-swing)
82+ URL navigation and tab selection
83+ Compatible with all jQuery versions (jQuery 1.11.1+, jQuery 2+, jQuery 3.5+)
84+ Auto content height adjustment
85+ Auto Progress (automatic navigation of tabs)
86+ Ajax content loading support
87+ Keyboard navigation
88+ External anchor support
89+ Custom events
90+ Supports all modern browsers
91+ Easy to implement and minimal HTML required
92
93Usage
94-----
95
96Include jQuery SmartTab CSS
97```html
98<link href="../dist/css/smart_tab_all.min.css" rel="stylesheet" type="text/css" />
99```
100
101Include HTML
102```html
103<div id="smarttab">
104
105 <ul class="nav">
106 <li>
107 <a class="nav-link" href="#tab-1">
108 Tab 1
109 </a>
110 </li>
111 <li>
112 <a class="nav-link" href="#tab-2">
113 Tab 2
114 </a>
115 </li>
116 <li>
117 <a class="nav-link" href="#tab-3">
118 Tab 3
119 </a>
120 </li>
121 <li>
122 <a class="nav-link" href="#tab-4">
123 Tab 4
124 </a>
125 </li>
126 </ul>
127
128 <div class="tab-content">
129 <div id="tab-1" class="tab-pane" role="tabpanel">
130 Tab content
131 </div>
132 <div id="tab-2" class="tab-pane" role="tabpanel">
133 Tab content
134 </div>
135 <div id="tab-3" class="tab-pane" role="tabpanel">
136 Tab content
137 </div>
138 <div id="tab-4" class="tab-pane" role="tabpanel">
139 Tab content
140 </div>
141 </div>
142</div>
143```
144Include jQuery (*ignore this if you have already included on the page*).
145```html
146<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
147```
148Include jQuery SmartTab JavaScript
149```html
150<script type="text/javascript" src="../dist/js/jquery.smartTab.min.js"></script>
151```
152Initialize the jQuery SmartTab
153```html
154<script type="text/javascript">
155 $(document).ready(function(){
156
157 // SmartTab initialize
158 $('#smarttab').smartTab();
159
160 });
161</script>
162```
163That's it!
164
165Please see the [documentation](http://techlaboratory.net/jquery-smarttab#documentation) for more details on implementation and usage.
166
167##### All options
168```JavaScript
169// SmartTab initialize
170$('#smarttab').smartTab({
171 selected: 0, // Initial selected tab, 0 = first tab
172 theme: 'default', // theme for the tab, related css need to include for other than default theme
173 orientation: 'horizontal', // Nav menu orientation. horizontal/vertical
174 justified: true, // Nav menu justification. true/false
175 autoAdjustHeight: true, // Automatically adjust content height
176 backButtonSupport: true, // Enable the back button support
177 enableURLhash: true, // Enable selection of the tab based on url hash
178 transition: {
179 animation: 'none', // Effect on navigation, none/fade/slide-horizontal/slide-vertical/slide-swing
180 speed: '400', // Transion animation speed
181 easing:'' // Transition animation easing. Not supported without a jQuery easing plugin
182 },
183 autoProgress: { // Auto navigate tabs on interval
184 enabled: false, // Enable/Disable Auto navigation
185 interval: 3500, // Auto navigate Interval (used only if "autoProgress" is enabled)
186 stopOnFocus: true, // Stop auto navigation on focus and resume on outfocus
187 },
188 keyboardSettings: {
189 keyNavigation: true, // Enable/Disable keyboard navigation(left and right keys are used if enabled)
190 keyLeft: [37], // Left key code
191 keyRight: [39] // Right key code
192 }
193});
194```
195
196License
197----
198[MIT License](https://github.com/techlab/jquery-smarttab/blob/master/LICENSE)
199
200Contribute
201----
202If you like the project please support with your contribution.
203
204[Donate on Paypal](https://www.paypal.me/dipuraj)
205
206Thank you and Happy Coding!