Document节点快捷方式属性中document.fullscreenElement属性的例子
if (document.fullscreenElement.nodeName == 'VIDEO') {
console.log('全屏播放视频');
}
好像有问题,报错提示 document.fullscreenElement is null。
在判断中加上?则不会报错,
if (document.fullscreenElement?.nodeName == 'VIDEO') {
console.log('全屏播放视频');
}