Jquery's Tabs content rotation implementation code, several lines to deal
This article mainly introduces the implementation code of Jquery's Tabs content rotation effect. Several lines of code are easy to handle
The Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> Jquery's Tabs content rotation implementation code, several lines to deal with </title>
<Script language = "javascript" type = "text/javascript" src = "/Scripts/jquery-1.4.4.min.js"> </script>
<Style type = "text/css">
* {Margin: 0; padding: 0 ;}
Body {font: 12px Verdana, Geneva, sans-serif; color: #404040 ;}
. Tabs {margin: 10px 0 0 20px; width: 360px; position: relative; overflow: hidden; height: 1%; height: 160px ;}
. Tabs span {z-index: 2; font-size: 12px; border: 1px solid # d5d5d5; width: 95px; height: 25px; line-height: 25px; text-align: center; float: left; margin-right: 5px; cursor: pointer ;}
Span. active {background-position: 0-25px; background-color: # d5d5d5 ;}
# Tab-01, # tab-02, # tab-03 {position: absolute; top: 26px; left: 0; width: 338px; padding: 10px; height: 93px; border: 1px solid # d5d5d5; z-index: 1 ;}
# Tab-02, # tab-03 {display: none ;}
</Style>
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ('. Tabs span'). mouseover (function (){
// Hide div
$ ('. Tabs div'). hide ();
// Query. tabs span peer element div display next to the peer element span
$ (This ). siblings ('span '). removeClass ('active '). end (). addClass ('active '). next ('div '). show ();
});
});
</Script>
</Head>
<Body>
<Div class = "tabs">
<! -- The first tab is activated by default -->
<Span class = "active"> hot news </span>
<Div id = "tab-01"> news </div>
<Span> entertainment news </span>
<Div id = "tab-02"> enteriment </div>
<Span> Employment Situation </span>
<Div id = "tab-03"> jobs </div>
</Div>
</Body>
</Html>