title: Add remove class based on accordion state
body: <p>I have accordion buttons that I need to change based on accordion state (show, hide). I can do it no problem with click event but I would like to bind it to the state of the accordion</p>
  
  <p>I tried adding an event handler to the accordion function I have written but I must be doing it incorrectly</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var accordionBtn = $('.accordion-btn');
  var bedAccordion = $('.accordion');
  
  $(document).ready(function() {
    $(bedAccordion).on('show.bs.collapse', function() {
      $(this).find('i').removeClass('fa-plus');
      $(this).find('i').addClass('fa-minus');
      $('.collapse').collapse('hide');
    });
  
    $(bedAccordion).on('hide.bs.collapse', function() {
      $(this).find('i').removeClass('fa-minus');
      $(this).find('i').addClass('fa-plus');
    });
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" /&gt;
  &lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" /&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;div class="accordion"&gt;
    &lt;button class="btn accordion-btn button--arrow-right" type="button" data-toggle="collapse" data-target="#bedAccordion1" aria-expanded="false" aria-controls="bedAccordion1"&gt;&lt;i class="fas fa-plus"&gt;&lt;/i&gt;&lt;/button&gt;
    &lt;span class="title-3"&gt;Test&lt;/span&gt;
    &lt;div class="col collapse-content"&gt;
      &lt;div class="collapse multi-collapse" id="bedAccordion1"&gt;
        &lt;div class="border--left"&gt;
          &lt;p&gt;&lt;b&gt;Test&lt;/b&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;br&gt; Test
          &lt;/p&gt;
          &lt;p&gt;test&lt;br&gt; test
          &lt;/p&gt;
          &lt;p&gt;&lt;b&gt;test&lt;/b&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;br&gt; Test&lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'd like to bind this event below to the above function so the changes happen on show and hide collapse</p>
  
  <pre><code>    $(accordionBtn).click(function () {
          $(this).toggleClass('accordion-btn--open');
          $(this).toggleClass('button--arrow-right');
      });
  });
  </code></pre>
  
  <p>bind the button toggle class to the state of the accordion and functions above</p>