Skip to content

Commit 02915d2

Browse files
committed
Improve README.md
1 parent 4b632a0 commit 02915d2

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Usage
1616
-----
1717

1818
### Entering Fullscreen mode
19-
19+
2020
You can either switch the whole page or a single HTML element to fullscreen
2121
mode:
22-
22+
```js
2323
$(document).fullScreen(true);
2424
$("#myVideo").fullScreen(true);
25-
25+
```
2626
This only works when the code was triggered by a user interaction (For
2727
example a onclick event on a button). Browsers don't allow entering
2828
fullscreen mode without user interaction.
@@ -33,10 +33,10 @@ fullscreen mode without user interaction.
3333
Fullscreen mode is always exited via the document but this plugin allows
3434
it also via any HTML element. The owner document of the selected HTML
3535
element is used then:
36-
36+
```js
3737
$(document).fullScreen(false);
3838
$("#myVideo").fullScreen(false);
39-
39+
```
4040

4141
### Querying Fullscreen mode
4242

@@ -46,41 +46,41 @@ browser doesn't support this) when fullscreen mode is active, `false` if not
4646
active or `null` when the browser does not support fullscreen mode at all.
4747
So you can use this method also to display a fullscreen button only when the
4848
browser supports fullscreen mode:
49-
49+
```js
5050
$("#fullscreenButton").toggle($(document).fullScreen() != null))
51-
51+
```
5252

5353
### Toggling Fullscreen mode
5454

5555
The plugin provides another method for simple fullscreen mode toggling:
56-
56+
```js
5757
$(document).toggleFullScreen();
58-
58+
```
5959

6060
### Notifications
6161

6262
The plugin triggers a `fullscreenchange` event on the document when the
6363
fullscreen mode has been changed. If the browser rejected a fullscreen
6464
state change then the plugin triggers a `fullscreenerror` event on the
6565
document. Example:
66-
66+
```js
6767
$(document).bind("fullscreenchange", function() {
6868
console.log("Fullscreen " + ($(document).fullScreen() ? "on" : "off"));
6969
});
7070

7171
$(document).bind("fullscreenerror", function() {
7272
alert("Browser rejected fullscreen change");
7373
});
74-
74+
```
7575

7676
### Fullscreen iframe
7777

7878
Entering fullscreen mode from within an iframe is not allowed by default but
7979
it can be enabled with a few attributes on the iframe:
80-
80+
```html
8181
<iframe src="iframe.html" webkitAllowFullScreen mozAllowFullScreen allowFullScreen>
8282
</iframe>
83-
83+
```
8484
### Known issues
8585

8686
* In IE 11 an empty page is displayed when entering fullscreen from within an

0 commit comments

Comments
 (0)