Below is I write a small tab switch plug-in, Welcome to discuss the exchange of views, do not understand or do not understand can contact me
HTML code:
<!doctype html>
<meta charset= "UTF-8" >
<title>tab Switch--jquery version </title>
<link rel= "stylesheet" href= "Css/tab.css"/>
<body>
<!--<button id= "btn" > Test </button>-->
<div class= "tab" >
<ul class= "Tabnav clearfix" >
<li class= "High" >1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<div class= "Tabview" >
<div class= "Tatcontent" >
<div class=>, the Vatican magistrate, has a wide range of styles after <br/> in the local gale </div>
<div> is not the way individual tutoring gives you the style of spending more <br/> multi-style southern girl wide recovery year </div>
<div> are very extensive on-the-go, all-in-one style spending let go <br/> a lot of your troubles more glow </div>
<div> a good place for you to oppose the revitalization of the beans sent to you <br/> the answer to your Troubles </div>
<div> style and the French style of the can tide over the difficulties of the <br/> Russian dispute </div>
</div>
</div>
</div>
<script src= "Lib/jquery-1.8.3.js" ></script>
<script src= "Lib/jquery.tabs.1.0.js" ></script>
<script src= "Js/usetab.js" ></script>
</body>
CSS code:
@import "Reset.css";
Body {
font-size:14px;
Font-family:microsoft Yahei, Arial;
Color: #575757;
}
. tab {
width:355px;
border:1px solid #ccc;
margin:20px Auto;
}
. tabnav {
border-bottom:1px solid #ccc;
Background: #eee;
padding:3px 0 0 6px;
}
. Tabnav Li {
Float:left;
Cursor:default;
PADDING:6PX 30px;
}
. High {
Background: #fff;
border:1px solid #ccc;
Border-bottom:none;
position:relative;
top:1px;
}
. tabview {
height:150px;
Overflow:hidden;
position:relative;
}
. tatcontent {
Position:absolute;
}
. tatcontent Div {
width:650px;
height:150px;
Float:left;
}
JS Plugin code:
/*
* Plugin name: Tab switch
* Version: 1.0
* Function Parameters:
*EVT: Event name for example: Click,mouseover, etc.
*highlight: Wang Chao Leopard
*easing
*direction
*
* */
;(function ($) {
$.fn.extend ({
Tabs:function (option) {
Defining Default Parameters
var settings={
EVT: ' MouseOver ',
HighLight: ' High ',
Direction: "Left",
index:0,
Target: '. Tatcontent '
}
var opts= $.extend ({},settings,option),
EVT=OPTS.EVT,
High=opts.highlight,
Easing=opts.easing,
Direction=opts.direction,
Index=opts.index,
target=$ (Opts.target),
$this =this,
Targetchild=target.children ();
This.eq (Index). addclass (High), siblings (). Removeclass (high);
if (direction== "left") {
Target.css ("width", targetchild.length*targetchild.width ());
}else if (direction== "top") {
Target.css ("Height", targetchild.length*targetchild.height ());
}
function Move () {
$this. EQ (index). addclass (High). Siblings (). Removeclass (high);
alert (this.length);
if (easing== "slide") {
if (direction== "left") {
Target.animate ({"Left":(-index) *targetchild.width ()},time);
}else if (direction== "top") {
Target.animate ({"Top":(-index) *targetchild.height ()},time);
}
}else {
Targetchild.hide (). EQ (index). Show ();
}
}
Return This.each (function (I,el) {
$ (this). On (Evt,function () {
Index=i;
Move ();
});
});
}
});
}) (JQuery);
You can contact me if you do not understand or understand, and you are welcome to exchange discussions.
Jquerytab plugin notation