This time I will share jQuery Plugin and tutorial about Switch Between Content Sections With jQuery Easy-Tabs Plugin, hope it will help you in programming stack.
A tiny yet fully customizable tabs system built with jQuery that enables the user to switch between sectioned (tabbed) content by clicking on the associated tabs.
How to use it:
1. The required HTML structure for the tabs & tabbed content.
01 |
< div id = "example" class = "zeus-tab" onchage = "handleTabClick" > |
02 |
< ul class = "zeus-tab-title" > |
03 |
< li class = "tab-current" >Tab 1</ li > |
07 |
< div class = "zeus-tab-content" > |
08 |
< div class = "zeus-tab-item tab-show" > |
11 |
< div class = "zeus-tab-item tab-show" > |
14 |
< div class = "zeus-tab-item tab-show" > |
2. The required CSS styles for the tabs system. Copy and paste the following CSS rules into your document.
05 |
.zeus-tab > .zeus-tab-title { |
14 |
.zeus-tab-title > li { |
15 |
display : inline- block ; |
16 |
vertical-align : middle ; |
27 |
.zeus-tab-title .tab-current { |
35 |
.zeus-tab-content > .zeus-tab-item { |
39 |
.zeus-tab-content .tab- show { |
40 |
display : block !important ; |
43 |
.zeus-tab .zeus-tab-title { |
44 |
border-bottom : 1px solid #E6E6E6 ; |
47 |
.zeus-tab > .zeus-tab-title .tab-current { |
50 |
border-color : #E6E6E6 ; |
51 |
border-bottom-color : #FFFFFF ; |
52 |
border-radius: 2px 2px 0 0 ; |
54 |
background-color : #FFFFFF ; |
3. Or directly load the tab.css
in the document. This stylesheet also provides 2 beautiful themes for your design needs:
- brief: Add the
zeus-tab-brief
class to the top container.
- card: Add the
zeus-tab-card
class to the top container.
1 |
< link rel = "stylesheet" href = "css/tab.css" /> |
4. Load the main JavaScript file tabs.js
after jQuery. That’s it.
1 |
< script src = "/path/to/jquery.slim.min.js" ></ script > |
2 |
< script src = "js/tab.js" ></ script > |
5. Handle the click event on the tabs.
1 |
function handleTab1Click(li, index) { |
2 |
console.log( 'I Just Clicked Tab ' + index); |
Changelog:
2019-12-01
This awesome jQuery plugin is developed by kevin-zeus. For more Advanced Usages, please check the demo page or visit the official website.