# Disable UI buttons in fullscreen mode

**URL:** https://pdfjs.community/t/disable-ui-buttons-in-fullscreen-mode/1134
**Category:** Technical Support
**Created:** [November 2, 2021, 2:43pm UTC](https://pdfjs.community/t/disable-ui-buttons-in-fullscreen-mode/1134 "2021-11-02T14:43:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![user16](https://avatars.discourse-cdn.com/v4/letter/u/6bbea6/32.png) [@user16](https://pdfjs.community/u/user16)
#### Post date: [November 2, 2021, 2:43pm UTC](https://pdfjs.community/t/disable-ui-buttons-in-fullscreen-mode/1134/1 "2021-11-02T14:43:32Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.1.0

**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**  
/

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)
#### Post date: [November 2, 2021, 2:43pm UTC](https://pdfjs.community/t/disable-ui-buttons-in-fullscreen-mode/1134/3 "2021-11-02T14:43:36Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

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

Guides:
- [Customize toolbar in viewer - Header items - ToolGroupButton](https://pdfjs.express/documentation/ui-customization/customizing-header.8#toolgroupbutton)
- [MIME types](https://pdfjs.express/documentation/get-started-viewer/blazor/mime-types)
- [Remove annotations in viewer](https://pdfjs.express/documentation/annotation/remove-annotations)

APIs:
- [UI](https://pdfjs.express/api/UI.html#__anchor)
- [WebViewerInstance - new WebViewerInstance()](https://pdfjs.express/api/7.0/WebViewerInstance.html#WebViewerInstance__anchor)
- [UI.Hotkeys - on(key [, handler])](https://pdfjs.express/api/UI.Hotkeys.html#.on__anchor)

Forums:
- [Customizing “Text tools” group](https://pdfjs.community/t/customizing-text-tools-group/92/2)
- [Detect toolbarGroup mode](https://pdfjs.community/t/detect-toolbargroup-mode/984/3)
- [Recover from unexpected reload of iframe](https://pdfjs.community/t/recover-from-unexpected-reload-of-iframe/425/1)

---

<div class="post-metadata">

### Author: ![Logan](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/logan/32/13_2.png) [@Logan](https://pdfjs.community/u/Logan)
#### Post date: [November 3, 2021, 2:52pm UTC](https://pdfjs.community/t/disable-ui-buttons-in-fullscreen-mode/1134/4 "2021-11-03T14:52:19Z")

</div>

Hey!

You can actually just use native DOM events for that:

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

```

Thanks,  
Logan
