Disable UI buttons in fullscreen mode

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version

Detailed description of issue
I would like to disable a set of buttons in the viewer by default, and enable them when the user goes full screen. Is there a way to do that out of the box ? Is there an event I can listen to to detect a switch to full screen ?

Expected behaviour
Buttons not displayed in default viewer, visible in full screen viewer.

Does your issue happen with every document, or just one?

Link to document

Code snippet

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:



You can actually just use native DOM events for that:

  document.addEventListener('fullscreenchange', (event) => {
    if (document.fullscreenElement) {
      console.log(`Element: ${document.fullscreenElement.id} entered full-screen mode.`);
    } else {
      console.log('Leaving full-screen mode.');


1 Like