hide widget when printing | Community
Skip to main content

hide widget when printing

  • May 3, 2024
  • 1 reply
  • 0 views

I'm trying to apply “noprint” css class so widget doesn't get printed out… anyone have any idea how we can achieve this?

 

TIA!

1 reply

Tipene
  • May 7, 2024

Hey there,

The simplest approach off the top of my head would be to use the web widget Hide API together with the beforeprint event, e.g for messaging:

window.addEventListener("beforeprint", () => {
 zE('messenger', 'hide');
});

Then, just use the afterprint event to make the web widget visible again:

window.addEventListener("afterprint", () => {
  zE('messenger', 'show');
});

Hope this helps!

Tipene