jquery App Action---page tab (tabs)

Source: Internet
Author: User

Example:

<div class= "tab" >    <div class= "Tab_menu" >        <ul>            <li class= "selected" > Current events </li >            <li> Sports </li>            <li> Entertainment </li>        </ul>    </div>    <div class = "Tab_box" >        <div> events </div>        <div class= "Hide" > Sports </div>        <div class= "Hide "> Entertainment </div>    </div></div>    

Requirements: Bind the order-click event for the <li> element, highlight the currently clicked <li> element, and then remove the highlighting of the other sibling <li> elements while switching the tab contents.
The code is as follows:

var $div _li = $ ("Div.table_menu ul Li"), $div _li.click (Functijon () {    $ (this). AddClass ("selected")//Current <li> Highlight        . Siblings (). Removeclass ("selected");//Other peers <li> remove highlight    var index = $div _li.index (this);//Get current click <li > Index in all <li>    $ ("div_tab_box>div")//Select child nodes        . EQ (index). Show ();//Display the current <li> corresponding tab content        . Siblings (). Hide ()//hides other peers <li> corresponding tab content});    

  

jquery App Action---page tab (tabs)

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.