a b c
Suppose div ABC has been hidden
The effect I want to achieve is to click on the "a" in Li when the trigger is to display the following div a. Click on B to trigger the following Div B. How do you make Li (a) and Div (a) correspond?
Because in the end, we'll loop this code in PHP,
a
How many times can they trigger the display of the corresponding Div, regardless of the number of loops?
Reply content:
a b c
Suppose div ABC has been hidden
The effect I want to achieve is to click on the "a" in Li when the trigger is to display the following div a. Click on B to trigger the following Div B. How do you make Li (a) and Div (a) correspond?
Because in the end, we'll loop this code in PHP,
a
How many times can they trigger the display of the corresponding Div, regardless of the number of loops?
First of all, I suggest you use the Data-property for the upper and lower links . But if you don't use data-at the moment, I'll do it in the order first.
Below this is according to the a tag, the corresponding div automatically toggle, you can according to your needs to change.
$('#navbb').find('ul').on('click', 'a', function(event) { var index = $(event.currentTarget).parent().index(); $('#navbb div:eq(' + index + ')').toggle()})
http://segmentfault.com/q/1010000002537374