DocumentOrShadowRoot.fullscreenElement
read-only property returns the
元素
that is currently being presented in full-screen mode in this document, or
null
if full-screen mode is not currently in use.
Although this property is read-only, it will not throw if it is modified (even in strict mode); the setter is a no-operation and it will be ignored.
var element = document.fullscreenElement;
元素
object that's currently in full-screen mode; if full-screen mode isn't currently in use by the
document
>, the returned value is
null
.
This example presents a function,
isVideoInFullscreen()
, which looks at the value returned by
fullscreenElement
; if the document is in full-screen mode (
fullscreenElement
isn't
null
) and the full-screen element's
nodeName
is
VIDEO
, indicating a
<video>
element, the function returns
true
, indicating that the video is in full-screen mode.
function isVideoInFullscreen() {
if (document.fullscreenElement && document.fullscreenElement.nodeName == 'VIDEO') {
return true;
}
return false;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
全屏 API
The definition of 'Document.fullscreenElement' in that specification. |
实时标准 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
fullscreenElement
|
Chrome
53
Prefixed
|
Edge
≤18
Prefixed
|
Firefox
64
|
IE
Yes
Prefixed
|
Opera
40
Prefixed
|
Safari
Yes
Prefixed
|
WebView Android
53
Prefixed
|
Chrome Android
53
Prefixed
|
Firefox Android
64
|
Opera Android
41
Prefixed
|
Safari iOS
部分支持
12
Alternate Name
|
Samsung Internet Android
6.0
Prefixed
|
完整支持
部分支持
见实现注意事项。
用户必须明确启用此特征。
使用非标名称。
要求使用供应商前缀或不同名称。
Element.requestFullscreen()
Document.exitFullscreen()
:fullscreen
and
::backdrop
<iframe>
allowfullscreen
属性
DocumentOrShadowRoot
activeElement
fullscreenElement
pointerLockElement
styleSheets