Home Web Front-end JS Tutorial jquery's index method implements tab effect_jquery

jquery's index method implements tab effect_jquery

May 16, 2016 pm 06:10 PM
tab

jquery's index method implements tab effect_jquery
The tabs are on the left and the details are on the right.

Principle:

Click the list item on the left to display the nth content at [index n] of the list based on the selected list item.

(First, the list and content need to be loaded into the page at one time, and only the first content is displayed, so it is more user-friendly to switch.)

How to get the index of the selected list item in the list:

There is a method in jquery which is index([subject])

$("#ul li").index($("#selected"));

It means first setting the list range (#ul li list), and then returning the index of the $("#selected") element in the list.

After obtaining the index, use $("#detail").hide(); $("#detail").eq(n).show(); to display the details of the same index. (The same goes for option list style switching)

only uses 5 lines.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solve the problem that CentOS7's Tab key cannot complete commands Solve the problem that CentOS7's Tab key cannot complete commands Jan 17, 2024 pm 01:30 PM

Today I was doing an experiment on centOS and found that the customary tab key completion method used under Ubuntu could not be used. So I was very curious. After searching for information and testing it myself, I recorded the possible solutions as follows: 1) First, you need to Run the following command in the terminal: #yuminstallbash-completion//You can also use wildcard installation: yuminstallbash-c* or you can install some initialization package groups yum-ygroupinstallBaseCompatibilitylibrariesDebuggingToolsDial-upNetworkingsupppo

How to implement tab components and multi-tab pages in Vue? How to implement tab components and multi-tab pages in Vue? Jun 25, 2023 am 09:33 AM

With the continuous updating of front-end technology, Vue, as a popular front-end framework, has become the first choice of many developers. In actual projects, it is often necessary to use tab components and multi-tab pages to switch and manage different functional modules. In this article, we will introduce how to use Vue to implement a simple tab component and multi-tab page. 1. Implement a simple tab component. Create a Tab.vue component. Create a Tab.vue component in the project to display it.

What are the three ways to implement tab in Vue? What are the three ways to implement tab in Vue? Jan 29, 2023 pm 02:49 PM

There are three ways to implement tabs in Vue: 1. Control tab content switching through "v-show"; 2. Implement tab switching through the is feature and "keep-alive" cache in Vue; 3. Implement route switching through "router-link" .

Why can't alt+tab switch interfaces? Why can't alt+tab switch interfaces? Mar 09, 2023 pm 02:11 PM

The reason why alt+tab cannot switch the interface is that this command is disabled. The solution: 1. Turn on the computer, click the start menu, and select the run command; 2. Enter "regedit" in the blank bar to the right of the start, and click OK; 3. Enter the Registry Manager and find the "AltTabSettings" option; 4. Double-click "AltTabSettings", modify the value data in the opened option to "00000001", and click "Confirm".

RedMagic reveals more specs of its new gaming tablet RedMagic reveals more specs of its new gaming tablet Sep 01, 2024 am 06:34 AM

The second RedMagic gaming tablet will be fully unveiled on September 5. A recent benchmark run on AnTuTu revealed that it will feature the Snapdragon 8 Gen 3 Leading Version, making it as capable as the company’s latest Android smartphone, the 9S Pr

RedMagic Gaming Tablet Pro launches as first tab with Snapdragon 8 Gen 3 Leading Version RedMagic Gaming Tablet Pro launches as first tab with Snapdragon 8 Gen 3 Leading Version Sep 05, 2024 pm 09:30 PM

RedMagic has fully unveiled the Gaming Tablet Pro, the first tab to feature the Snapdragon 8 Gen 3 Leading Version. It’s basically the overclocked version of the standard SoC, and the RedMagic 9S Pro leads benchmarks with it. The same is true for thi

Deal | Lenovo Tab P12 Android tablet with large 3K display gets enticing 29% price cut Deal | Lenovo Tab P12 Android tablet with large 3K display gets enticing 29% price cut Aug 15, 2024 am 06:44 AM

Many travelers who are looking forward to their summer vacation are probably asking themselves how to kill some time on a long train ride or international flight, and a cheap multimedia tablet such as the Lenovo Tab P12 might solve this issue. Conseq

Xiaomi reveals launch date of new Poco Pad with 5G connectivity Xiaomi reveals launch date of new Poco Pad with 5G connectivity Aug 17, 2024 am 06:32 AM

Xiaomi has announced a new Android tablet that will launch under the Poco branding. It's called the Poco Pad 5G, and the tab is set to launch in India on August 23. The first-ever table that launched under the Poco brand was revealed in Mayof this ye

See all articles