<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/ Xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Effect Code </title>
<link href= ". /images/res/master.css Tutorial "rel=" stylesheet "type=" Text/css "/>"
<body>
<script src= "http://www.google.com/Web Effects API" ></script>
<script type= "text/web Effects" >
Google.load ("jquery", "1.3.1");
</script>
<script type= "Text/javascript" >
$ (function () {
$ ("#tab1 Li"). each (
function (i) {
$ (this). Click (function () {
if (!$ (this). Hasclass ("hover")) {
$ ("#tab1 li"). Removeclass ("hover");
$ (this). addclass ("hover")
$ (". List1"). Removeclass ("Tabnow");
$ (". List1"). EQ (i). addclass ("Tabnow");
}
});
})
$ ("#tab2 Li"). each (
Function (j) {
$ (this). Click (function () {
if (!$ (this). Hasclass ("hover")) {
$ ("#tab2 li"). Removeclass ("hover");
$ (this). addclass ("hover")
$ (". List2"). Removeclass ("Tabnow");
$ (". List2"). EQ (j). addclass ("Tabnow");
}
});
}
);
})
</script>
<div class= "News" >
<ul class= "tab" id= "Tab1" >
<li class= "Hover" > Company news
<li> Industry News
<li> Small Knowledge
</ul>
<div class= "lists" >
<div style= "padding:10px 0;" class= "List1 Tabnow" >
Shown here
Class "list1" of the content
</div>
<div class= "List1" > Show here
Class "list2" The content </div>
<div class= "List1" > Show here
Class "list3" The content </div>
</div>
</div>
<div class= "Products" >
<ul class= "tab" id= "TaB2" >
<li class= "hover" > Machinery
<li> Forging
<li> Metal
</ul>
<div>
<div class= "List2 tabnow" >
<div class= "Columnspace"
Id= "elem-frontproducts_list01-1277815698970" name= "Product List" >
<!--#include virtual= "/comp-frontproducts_list01-1277815698970"--></div>
</div>
<div class= "List2"
style= "Display:none" > Show here
Class "list2" The content </div>
<div class= "List2"
style= "Display:none" > Show here
Class "list3" The content </div>
</div>
</div>
</body>
jquery write tab Tab effect
<script>
$.fn.tabs = function (Tablist, tabtxt, options) {
var _tablist = $ (this). Find (Tablist);
var _tabtxt = $ (this). Find (Tabtxt);
In order to simplify the operation, the mandatory tab must be implemented with the LI tag
var Tablistli = _tablist.find ("Li");
var defaults = {currenttab:0, Defaultclass: "Current", Isautoplay:false, steptime:2000, Switchingmode: "C"};
var o = $.extend ({}, defaults, options);
var _isautoplay = O.isautoplay;
var _steptime = O.steptime;
var _switchingmode = O.switchingmode;
_tablist.find ("Li:eq (" + O.currenttab +) "). AddClass (O.defaultclass);
Enforce that the content layer must be implemented with DIV
_tabtxt.children ("div"). each (function (i) {
$ (this). attr ("id", "wp_div" + i);
). EQ (o.currenttab). CSS ({"Display": "Block"});
Tablistli.each (
function (i) {
$ (Tablistli[i]). Mouseo Tutorial Ver (
function () {
if (_switchingmode = = "O") {
$ (this). Click ();
}
_isautoplay = false;
}
);
$ (Tablistli[i]). Mouseout (
function () {
_isautoplay = true;
}
)
}
);
_tabtxt.each (
function (i) {
$ (_tabtxt[i]). MouseOver (
function () {
_isautoplay = false;
}
);
$ (_tabtxt[i]). Mouseout (
function () {
_isautoplay = true;
}
)
});
// }
else {
Tablistli.each (
function (i) {
$ (Tablistli[i]). Click (
function () {
if ($ (this). ClassName!= O.defaultclass) {
$ (this). addclass (O.defaultclass). Siblings (). Removeclass (O.defaultclass);
}
if ($.browser.msie) {
_tabtxt.children ("div"). EQ (i). Siblings (). css ({"Display": "None"});
_tabtxt.children ("div"). EQ (i). Fadein (600);
} else {
_tabtxt.children ("div"). EQ (i). CSS ({"Display": "Block"}). Siblings (). css ({"Display": "None"}); Standard Style
}
}
)
}
);
// }
function Selectme (oo) {
if (oo!= null && oo.html ()!= null && _isautoplay) {
Oo.click ();
}
if (oo.html () = null) {
Selectme (_tablist.find ("Li"). EQ (0));
} else {
Window.settimeout (Selectme, _steptime, Oo.next ());
}
}
if (_isautoplay) {
Alert ("_isautoplay:" + _isautoplay);
Selectme (_tablist.find ("Li"). EQ (o.currenttab));
}
alert (_isautoplay);
return this;
};
var username = "Wbpbest";
var __sti = setinterval;
Window.setinterval = function (callback, timeout, param) {
var args = Array.prototype.slice.call (arguments, 2);
var _CB = function () {
Callback.apply (null, args);
}
__sti (_CB, timeout);
}
Window.setinterval (Hello,3000,username);
var __sto = settimeout;
Window.settimeout = function (callback, timeout, param) {
var args = Array.prototype.slice.call (arguments, 2);
var _CB = function () {
Callback.apply (null, args);
}
__sto (_CB, timeout);
}
Note: If debugging fails, please check the jquery version number that you are referencing, the current reference version is 1.3
Parameter description:
Tablist: Parent Layer of package tab
Tabtxt: The parent layer of the package content layer
Options.currenttab: Activate the TAB's serial number
Options.defaultclass: Current tab Activates State style name, default name is
Isautoplay: whether to switch automatically
Steptime: Toggle time interval
Switchingmode: Toggle Mode (' C ' means click Switch; O ' means mouseover switch)
JS Download Address
<script type= "Text/javascript" src= "Http://g.111cn.net/javascript/js/111cn.net.js" ></script>
</script>