SuperFlexi - Accordion default collapsed

Post here if you have questions about creating SuperFlexi Solutions.

The SuperFlexi documentation is very thorough, so you might want to start there.

This thread is closed to new posts. You must sign in to post in the forums.
11/7/2018 9:18:03 PM
Gravatar
Total Posts 221

SuperFlexi - Accordion default collapsed

SuperFlexi is the best thing since sliced bread.... I can think of all kinds of very useful little modules for this. Amazing really.

Question: I've been playing around with the accordion solution trying to set the default state to all closed. I personally think for most uses you'd want the default closed (FAQ, support questions, etc). The point of a list like this is to save space and let the user select the option they are interested in. Opening the first one by default defeats the purpose a little.

 

With the old accordion I used a trick like this in the skin (can't seem to modify for Flexi)

<script type="text/javascript">// <![CDATA[ $('div.mojo-accordion-nh').accordion({active:false, collapsible:true, heightStyle: "content", autoHeight:false, fx:{opacity:'toggle',duration:'fast'}}); // ]]></script>

 

Any smart ideas before I spend too many hours tinkering?

11/12/2018 12:50:52 PM
Gravatar
Total Posts 216
Community Expert

mojoPortal Hosting & Design @ i7MEDIA!

Re: SuperFlexi - Accordion default collapsed

Hi Eric,

With the bootstrap accordion only ".active" items are opened. We opened the first one by default with a script that is included on line 135 of the accordion.sfMarkup file. You can fully delete this or comment it out and it should cause all items to be closed until they are clicked.

For reference, here is the script (it finds the first item with data-toggle="collapse" and clicks it):

 <Script position="bottomStartup" name="AccordionInit"><![CDATA[$(document).ready(function(){$('.accordion__items').each(function(){$(this).find('[data-toggle="collapse"]').eq(0).click()})});]]></Script>

Hope this helps!

11/12/2018 2:00:53 PM
Gravatar
Total Posts 221

Re: SuperFlexi - Accordion default collapsed

Thanks, that is making sense. I tried commenting that line out and even tried deleting the entire accordion.sfMarkup file....but it doesn't change anything and superflexi keeps working as though the file has no affect. I restarted the web, touched the web.config with no change.

Thoughts?

11/12/2018 2:11:24 PM
Gravatar
Total Posts 2253

Re: SuperFlexi - Accordion default collapsed

Hi Eric,

I just noticed that I made a mistake when updating some of the methods for SuperFlexi and the sfMarkup file isn't re-read properly after setting the solution in the module settings. I've fixed this in the repo and will be publishing a minor version update this week. In the mean time, you should be able to work around this problem by choosing a new solution, saving the settings and then going back and choosing the original solution again.

Thanks,
Joe

You must sign in to post in the forums. This thread is closed to new posts.