Jquery's Tabs content rotation implementation code, several lines to deal

Source: Internet
Author: User

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>

 

Related Article

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.