JQ tab tab

Source: Internet
Author: User

JQ Options Card is very simple, the attention is his structure naming (there are many on the internet, which is not a norm)

1.tab

2.TAB-HD (Options Bar)

3.TAB-BD (the options bar corresponds to the content)

CSS code (layout no problem, can only see jquery code)

*{padding:0; margin:0;} UL {List-style:none;}. tab {width:450px; height:200px; overflow:hidden; border:1px solid #ccc; margin:0 Auto;}. Tab-hd ul {Overflow:hidden;  Margin-left: -4px; }.tab-hd li {float:left; width:150px; border-left:1px solid #ccc; border-bottom:1px solid #ccc; line-height:50px; font -size:24px; Text-align:center; Cursor:pointer;}. TAB-HD li.selected {border-bottom:none;}. TAB-BD li {display:none; font-size:30px; line-height:5; text-align:center;}

HTML code:

<div class= "tab" ><div class= "TAB-HD" ><ul><li class= "selected" > Project I </li><li> project two </li><li> Project three </li></ul></div><div class= "TAB-BD" ><ul><li style= " Display:block; " >111111</li><li>222222</li><li>333333</li></ul></div></div>

JQ Code:

$ (function () {$ ('. Tab-hd li '). Click (function () {$ (this). AddClass (' selected '). Siblings (). Removeclass (' selected '); /This can be written as the following code/* $ ('. Tab-hd li '). Removeclass (' selected '); $ (this). AddClass (' selected '); */$ ('. tab-bd li '). Hide (). EQ ($ (this). Index ()). Show ();}). Hover (function () {//can add other animation effects});})

  

JQ tab tab

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.