/**
 * @description affichage des accordeons sur mobile
 */

function collapseMobile() {
  const els = document.querySelectorAll('.collapse-mobile');
  Array.from(els)
    .forEach((el) => {
      if (window.matchMedia('(min-width: 992px)').matches) {
        el.removeAttribute('data-toggle');
      } else {
        el.setAttribute('data-toggle', 'collapse');
      }
    });
}


export default () => {
    collapseMobile();
    window.addEventListener('resize ', function (event) {
        collapseMobile();
    }, false);
    window.addEventListener(' orientationchange', function (event) {
        collapseMobile();
    }, false);

}

