0

Zurb Foundation has data-options="multi_expand: true" to allow multiple accordion sections to be expanded simultaneously, however as far as I can tell this option can only be specified in your HTML, so you cannot toggle this at runtime (i.e. to allow users to switch between modes without reloading the page).

I tried changing data-options="multi_expand: true" to false at runtime, after the page had loaded, and calling $(document).foundation(); (which is valid, according to the documentation, see "Adding New Content After Page Load"), however this did not have any effect and the accordion retains the multi_expand option value it had when the page was first loaded by the browser.

Dai
  • 141,631
  • 28
  • 261
  • 374

1 Answers1

1

In Foundation 6, you will need to call Foundation.reInit($('#your-accordion')); after making any change to data-options.

From the docs

In previous versions of Foundation, there was a method for plugins called reflow, though it's inclusion on plugins wasn't universal. For Foundation 6 we've added a global reInit method that will remove and reapply event listeners, update the plugin's instance data for relevant information, like a new tab or content pane being added, and reset any cached data the plugin may rely on.

inginia
  • 412
  • 1
  • 6
  • 15
  • I think I'm using Foundation 5. Is there a clean and easy upgrade path to Foundation 6? – Dai Sep 29 '16 at 12:31
  • See this: http://stackoverflow.com/questions/36558589/work-needed-to-upgrade-zurb-foundation-v5-to-v6-2. Might not be clean, easy, or even complete. Personally haven't had to do a migration. – inginia Sep 29 '16 at 14:53