How to Open or Close Each Individual Accordion
I'm using the following link: viewtopic.php?f=1&t=106
But I'm having a hard time A) making all Accordions collapsed by default, and B) making the next according open based on field change.
What I want to happen is the next accordian to open with the last field on the previous accordion has been filled out.
I can make it work for the first accordion, but I don't know how to "identify" the next accordion section via Javascript.
Here's my current code:
fd.field('Product').change(function() {
$('#fd_accordion-0 > h3:eq(0)').click()
});
But I'm having a hard time A) making all Accordions collapsed by default, and B) making the next according open based on field change.
What I want to happen is the next accordian to open with the last field on the previous accordion has been filled out.
I can make it work for the first accordion, but I don't know how to "identify" the next accordion section via Javascript.
Here's my current code:
fd.field('Product').change(function() {
$('#fd_accordion-0 > h3:eq(0)').click()
});
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
Just change the highlighted index in h3:eq function:
Just change the highlighted index in h3:eq function:
Code: Select all
fd.field('Product').change(function() {
$('#fd_accordion-0 > h3:eq(0)').click()
});
I think there may be something wrong with my setup.
Changing index number for the h3:eq function does not work for me.
However, if I click and drag a different Accordion onto the page, then changing the index does work for me. However, the index changes the control of the original Accordian, and the new Accordian I drag to the page has no functionality.
Anyway, I'm going to move on from this, as it seems too glitchy. Just wanted to give you the additional info.
Changing index number for the h3:eq function does not work for me.
However, if I click and drag a different Accordion onto the page, then changing the index does work for me. However, the index changes the control of the original Accordian, and the new Accordian I drag to the page has no functionality.
Anyway, I'm going to move on from this, as it seems too glitchy. Just wanted to give you the additional info.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
If you use the accordion in 'Single' or 'SingleCollapsable' modes, you can try the following code to activate a particular section:
If you use the accordion in 'Single' or 'SingleCollapsable' modes, you can try the following code to activate a particular section:
Code: Select all
$('#fd_accordion-0').accordion( "option", "active", 1);
-
- Information
-
Who is online
Users browsing this forum: No registered users and 26 guests