Fullscreen.js
Fullscreen.js is a simple wrapper for using Fullscreen API in browsers.
This allows one to work around the various vendor-prefixed implementations of the API, and provides some convenience routines for listening for ctrl+f or cmd+f to toggle fullscreen mode.
More useful features may be added if they seem useful --- contributions are more than welcome.
(This was initially written as a helper for my Web Unleashed 2014 slide deck as a way to switch the presentation to fullscreen mode... I'm sure it has other uses, so send me a pull request if you want/need something from it!)
Usage
| Method | Arguments | Description |
|---|---|---|
$fullscreen.listen() |
Start listening for ctrl+f or cmd+f in order to toggle fullscreen mode --- listens on document. | |
$fullscreen.deafen() |
Stop listening for key events | |
$fullscreen.enter() |
|
Request fullscreen mode for a given element (or the document element if omitted), optionally with flags |
$fullscreen.exit() |
Exits (cancels) fullscreen mode for the current fullscreen element, if any | |
$fullscreen.toggle() |
Exits (cancels) fullscreen mode if there is a current fullscreen element, or requests fullscreen mode if there isn't. |
License
(c) 2014 Caitlin Potter & Contributors
Fullscreen.js is MIT-licensed. See LICENSE for details.