Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You just have to stop the click event progation over the accordion items, then, if you click in a child accordion item, child click event won't close the parent item.</p> <p>The modification is easy, you have to <strong>add the param event in the click handler</strong>, and use <strong>event.stopPropagation();</strong> inside the else statament with the activation code of the current clicked element.</p> <p>the modified code, please, take a look on the code comments:</p> <pre><code>;(function ($, window, undefined){ 'use strict'; $.fn.foundationAccordion = function (options) { var $accordion = $('.accordion'); if ($accordion.hasClass('hover') &amp;&amp; !Modernizr.touch) { $('.accordion li', this).on({ mouseenter : function () { var p = $(this).parent(), flyout = $(this).children('.content').first(); $('.content', p).not(flyout).hide().parent('li').removeClass('active'); flyout.show(0, function () { flyout.parent('li').addClass('active'); }); } }); } else { //be sure to add the param event in the click function handler $('.accordion li', this).on('click.fndtn', function (event) { var li = $(this), p = $(this).parent(), flyout = $(this).children('.content').first(); if (li.hasClass('active')) { p.find('li').removeClass('active').end().find('.content').hide(); } else { //stop event propagation event.stopPropagation(); $('.content', p).not(flyout).hide().parent('li').removeClass('active'); flyout.show(0, function () { flyout.parent('li').addClass('active'); }); } }); } }; })( jQuery, this ); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload