Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #983818

    Elke H
    Participant

    I could not answer to a topic i posted some time ago: https://community.theme.co/forums/topic/how-to-display-all-accordions-open-in-media-print/

    I want all accordions to be displayed open in the print-version of the browser.

    after the latest updates this code does not work any longer, what do i have to change in the custom js code?

    
    (function($) {
    
       var beforePrint = function() {
          $('.accordion-body').removeClass('collapse').css('height', 'auto');
          $('.x-accordion-toggle').removeClass('collapsed');
       };
       var afterPrint = function() {
          $('.accordion-body').removeClass('collapse').css('height', 'auto');
          $('.x-accordion-toggle').removeClass('collapsed');
       };
    
       if (window.matchMedia) {
          var mediaQueryList = window.matchMedia('print');
          mediaQueryList.addListener(function(mql) {
             if (mql.matches) {
                beforePrint();
             } else {
                afterPrint();
             }
          });
       }
    
       window.onbeforeprint = beforePrint;
       window.onafterprint = afterPrint;
    
    })(jQuery);
    #984030

    Christopher
    Moderator

    Hi there,

    Upon checking your site, All accordions element are collapsed in print window, please see the attachment.

    Hope it helps.

    #984168

    Elke H
    Participant

    hi christopher,
    the site ihrkonzept.de (from the previous-forum-entry) is not update yet, today i updated another webpage in x-theme to the newest theme/plugin-version: https://private-insuring.de/das-ideale-angebot/

    on this page the print-preview does not open the accordions

    thanks for the fast reply,
    elke

    #984254

    Elke H
    Participant

    just updated the other page and the same problem occured, now the accordions are closed in the print preview: https://ihrkonzept.de/private-insuring/fonds-und-etfs-zur-auswahl-fuer-sie/

    on ihrkonzept.de i updated x version 4.2.2 to 4.4.2

    so far,
    elke

    #985174

    Lely
    Moderator

    Hello Elke,

    Please try adding the following custom CSS on Appearance > Customize > Custom > Edit Global CSS:

    @media print {
        .x-accordion-body.collapse{
            display:block !important;
        }
        
    }
    

    See this video screencast of my test:http://screencast-o-matic.com/watch/cDhXVG19nA
    Hope this helps.