Awesome Accordions website

Print screen

A big problem with accordions is that the content is hidden in a print screen. For this we created the following script. It will expand all panels when a user uses the print screen command.


var beforePrint = function () {
       $(".awesome-accordion-item").removeClass("closed");
       $(".awesome-accordion-panel").css("max-height", "none");
   };
   var afterPrint = function () {
       $(".awesome-accordion-item").addClass("closed");
       $(".awesome-accordion-panel").css("max-height", 0);
       $(".awesome-accordion-item").first().removeClass("closed").find(".awesome-accordion-panel").css("max-height", 400);
   };
   if (window.matchMedia) {
       var mediaQueryList = window.matchMedia('print');
       mediaQueryList.addListener(function (mql) {
           if (mql.matches) {
               beforePrint();
           }
           else {
               afterPrint();
           }
       });
   }
   window.onbeforeprint = beforePrint;
   window.onafterprint = afterPrint;