-
Notifications
You must be signed in to change notification settings - Fork 9
/
jquery.fullscreen.js
35 lines (31 loc) · 939 Bytes
/
jquery.fullscreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(function($, window, documentElement, height, width) {
var
isFullScreen = function() {
return (documentElement.clientHeight == height && documentElement.clientWidth == width) ||
window.fullScreen ||
(window.outerHeight == height && window.outerWidth == width)
;
}
,$window = $(window)
;
$window
.data('fullscreen-state', isFullScreen())
.resize(function() {
var fullscreenState = isFullScreen();
if ($window.data('fullscreen-state') && !fullscreenState) {
$window
.data('fullscreen-state', fullscreenState)
.trigger('fullscreen-toggle', [false])
.trigger('fullscreen-off')
;
}
else if (!$window.data('fullscreen-state') && fullscreenState) {
$window
.data('fullscreen-state', fullscreenState)
.trigger('fullscreen-toggle', [true])
.trigger('fullscreen-on')
;
}
})
;
})(jQuery, this, document.documentElement, screen.height, screen.width);