Multiple Tabs created by jquery

Source: Internet
Author: User

<! 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> multiple tabs created by jquery _ webpage code station (www.webdm.cn) </title>
<Script type = "text/javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"> </script>
<Script type = "text/javascript">

$ (Function (){
Var wweya_li = $ ("div. tab_menu ul li ");
Wweya_li.click (function (){
$ (This). addClass ("selected") // highlight the current <li> element
. Siblings (). removeClass ("selected"); // remove the highlight of <li> elements of other peers
Var index = wweya_li.index (this); // obtain the index of the currently clicked <li> element in all li elements.
$ ("Div. tab_box> div") // select a subnode. If you do not select a subnode, an error occurs. If there is a div inside
. Eq (index). show (100) // display the <div> element corresponding to the <li> element
. Siblings (). hide (); // hide <div> element} of several other peers). hover (function (){
$ (This). addClass ("hover ");
}, Function (){
$ (This). removeClass ("hover ");
})
})
</Script>
<Style type = "text/css">
* {Margin: 0; padding: 0 ;}
Body {font: 12px/19px Arial, Helvetica, sans-serif; color: #666 ;}
. Tab {width: 240px; margin: 50px ;}
. Tab_menu {clear: both ;}
. Tab_menu li {float: left; text-align: center; cursor: pointer; list-style: none; padding: 1px 6px; margin-right: 4px; background: # F1F1F1; border: 1px solid #898989; border-bottom: none ;}
. Tab_menu li. hover {background: # DFDFDF ;}
. Tab_menu li. selected {color: # FFF; background: #6D84B4 ;}
. Tab_box {clear: both; border: 1px solid #898989; height: 100px ;}
. Hide {display: none}
H1 {margin: 80px; line-height: 90px; font-size: 16px; color: #999; text-align: center; border-top: 1px solid # ddd ;}
</Style>
</Head>
<Body>
<Div class = "tab">
<Div class = "tab_menu">
<Ul>
<Li class = "selected"> constellation </li>
<Li> fashion </li>
<Li> entertainment </li>
</Ul>
</Div>
<Div class = "tab_box">
<Div> Pisces </div>
<Div class = "hide"> fashion trends </div>
<Div class = "hide"> Entertainment gossip </div>
</Div>
<Div class = "tab_menu">
<Ul>
<Li class = "selected"> constellation </li>
<Li> fashion </li>
<Li> entertainment </li>
</Ul>
</Div>
<Div class = "tab_box">
<Div> Pisces </div>
<Div class = "hide"> fashion trends </div>
<Div class = "hide"> Entertainment gossip </div>
</Div>
</Div>
<P> </p>
<P> it can be infinite, but must be paired. </p>
<P> </p>
<Div class = "tab_menu">
<Ul>
<Li class = "selected"> constellation </li>
<Li> fashion </li>
<Li> entertainment </li>
</Ul>
</Div>
<Div class = "tab_box">
<Div> Pisces </div>
<Div class = "hide"> fashion trends </div>
<Div class = "hide"> Entertainment gossip </div>
</Div>
<H1> by <a href = "/" target = "_ blank"> website code </a>
<Br/>
<P> <a href = "http://www.webdm.cn"> Web code site </a>-the most professional web code download site-is committed to providing quality web code for Chinese webmasters! </P>
</Body>
</Html>

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.