Pretty jquery Tab Tab plugin

Source: Internet
Author: User
Tags jquery library

JQuery TAB Plugin structure:

The code is as follows Copy Code

<div class= " Tabwrap ">  
<ul class=" Tabbox ">  
<li><a href=" #nogo ">tab1 </a ></li>  
<li><a href= "#nogo" >tab2 </a></li>  
<li ><a href= "#nogo" >tab3 </a></li>  
<li><a href= "#nogo" >tab4 </a ></li>  
<li><a href= "#nogo" >tab5 </a></li>  
</ul >  
<div class= "tabcontent" >  
<div class= "Tcon" >1111</div>   
<div class= "Tcon" >2222</div>  
<div class= "Tcon" >3333</div>   
<div class= "Tcon" >4444</div>  
<div class= "Tcon" >5555</div>   
</div>  
</div> 

JQuery Tab Plug-in code:

The code is as follows Copy Code

$ (function () {
$.fn.tabs = function (options) {
var settings = {
Tablist: "",
Tabcontent: "",
Tabon: "",
Action: ""
};
var _this = $ (this);
if (options) $.extend (settings, options);
_this.find (settings.tabcontent). EQ (0). Show (); The first column shows
_this.find (settings.tablist). EQ (0). addclass (Settings.tabon);
if (settings.action = = "MouseOver") {
_this.find (settings.tablist). Each (function (i) {
$ (this). MouseOver (function () {
$ (this). addclass (Settings.tabon). Siblings (). Removeclass (Settings.tabon);
var _tcon = _this.find (settings.tabcontent). EQ (i);
_tcon.show (). Siblings (). Hide ();
}); Slide over Toggle
});
}
else if (settings.action = = "click") {
_this.find (settings.tablist). Each (function (i) {
$ (this). Click (function () {
$ (this). addclass (Settings.tabon). Siblings (). Removeclass (Settings.tabon);
var _tcon = _this.find (settings.tabcontent). EQ (i);
_tcon.show (). Siblings (). Hide ();
}); Click to switch
});
};
};
Call Mode:
$ (". Tabwrap"). Tabs ({
Tablist: ". Tabbox li",//tab list
Tabcontent: ". Tabcontent. Tcon",//Content box
Tabon: "On",//Current tab class name
Action: "MouseOver"//event, mouseover or click
});
});

Small Tips

This article does not provide jquery library files, you can go to the official download the latest version of.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.