Skip to main content
100%

utilities for toggling fullscreen

✓ Published0🌍 Public
MMAKIO135
Last edited Mar 27, 2019
Created on Mar 27, 2019

This utility demonstrates a browser-based fullscreen toggle for data-visualization canvases. A single click event triggers the `toggleFullScreen()` function, which checks the current fullscreen state via `isFullScreen()` and then calls either `requestFullScreen(element)` or `exitFullScreen()`. The code provides cross-browser support by testing for standard and vendor-prefixed APIs (`requestFullscreen`, `msRequestFullscreen`, `mozRequestFullScreen`, `webkitRequestFullscreen`) and their exit counterparts. The script targets the document root element, making it applicable to any visualization rendered in the page.

AI-generated description

Similar vizzes