title: How to close tab by clicking on itself and not only by opening a new tab
body: <p>I have a set of 3 tabs. At any given time, only 1 tab can be opened because the other 2 close when I open one of them. So far so good. However I can't manage to close the open tab by clicking on it. Nothing happens when an already open tab is clicked on. It only closes if another tab is opened. My question is: how can I adjust this piece of code so that the open tab can be closed by clicking on itself? Here is the code:</p>
  
  <pre><code>$('.collapsible-trigger').on('click', function() {
      var x = $('.collapsible-trigger-btn--borders').hasClass('is-open') 
      var x = $('.collapsible-content--all').hasClass('is-open');
      if (x) {
          $('.collapsible-trigger-btn--borders').attr('aria-expanded','false');
          $('.collapsible-trigger-btn--borders').removeClass('is-open');
          $('.collapsible-content--all').removeClass('is-open');
          $('.collapsible-content--all').css("height","0px");
      }
  });
  </code></pre>
  
  <p>Any suggestions will be appreciated, thank you.</p>