Jquery's index method achieves the tab effect _ jquery
Source: Internet
Author: User
Jquery's index method achieves the tab effect. For more information, see.
Tab on the left and details on the right.
Principle:
Click the list item on the left to display the nth content in the [index n] of the selected list item.
(First, you need to load the list and content to the page at a time, and only the first content is displayed, so that the switchover is more friendly .)
How to obtain the index of the selected list item in the list:
One method in jquery is index ([subject]).
$ ("# Ul li"). index ($ ("# selected "));
This means that you first set the list range (# ul li list) and then return the $ ("# selected") element index in the list.
$ ("# Detail") is used after obtaining the index "). hide (); $ ("# detail "). eq (n ). show (); to display details of the same index. (The same is true for Option List style switching)
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