|
| 1 | +jQuery Fullscreen Plugin |
| 2 | +======================== |
| 3 | + |
| 4 | + |
| 5 | +Description |
| 6 | +----------- |
| 7 | + |
| 8 | +This jQuery plugin provides a simple to use mechanism to control the |
| 9 | +new fullscreen mode of modern browsers. Currently only newer Webkit-based |
| 10 | +browsers (Like Chrome) and Firefox provide this new fullscreen feature. |
| 11 | + |
| 12 | + |
| 13 | +Usage |
| 14 | +----- |
| 15 | + |
| 16 | +### Entering Fullscreen mode ### |
| 17 | + |
| 18 | +You can either switch the whole page or a single HTML element to fullscreen |
| 19 | +mode: |
| 20 | + |
| 21 | + $(document).fullScreen(true); |
| 22 | + $("#myVideo").fullScreen(true); |
| 23 | + |
| 24 | +This only works when the code was triggered by a user interaction (For |
| 25 | +example a onclick event on a button). Browsers don't allow entering |
| 26 | +fullscreen mode without user interaction. |
| 27 | + |
| 28 | +### Exiting Fullscreen mode ### |
| 29 | + |
| 30 | +Fullscreen mode is always exited via the document but this plugin allows |
| 31 | +it also via any HTML element. The owner document of the selected HTML |
| 32 | +element is used then: |
| 33 | + |
| 34 | + $(document).fullScreen(false); |
| 35 | + $("#myVideo").fullScreen(false); |
| 36 | + |
| 37 | +### Querying Fullscreen mode ### |
| 38 | + |
| 39 | +Simply pass no argument to the `fullScreen` method to query the current |
| 40 | +state. The method returns `true` when fullscreen mode is active, `false` |
| 41 | +if not or `null` when the browser does not support fullscreen mode at all. |
| 42 | +So you can use this method also to display a fullscreen button only when the |
| 43 | +browser supports fullscreen mode: |
| 44 | + |
| 45 | + $("#fullscreenButton").toggle($(document).fullScreen() != null)) |
| 46 | + |
| 47 | +### Toggling Fullscreen mode ### |
| 48 | + |
| 49 | +The plugin provides another method for simple fullscreen mode toggling: |
| 50 | + |
| 51 | + $(document).toggleFullScreen(); |
0 commit comments