Skip to content

Home > @jview/utils > enterFullscreen

enterFullscreen() function

进入全屏,可参考 https://developer.mozilla.org/zh-CN/docs/Web/API/Element/requestFullScreen。 存在 top-layer 叠加问题,如果要规避叠加顺序带来的问题,需要手动判断全屏状态,如果当前已经是全屏状态,可以先退出全屏,再让目标元素进入全屏。

Signature:

typescript
export declare function enterFullscreen(element?: EnhancedHTMLElement, options?: FullscreenOptions): Promise<void>;
export declare function enterFullscreen(element?: EnhancedHTMLElement, options?: FullscreenOptions): Promise<void>;

Parameters

ParameterTypeDescription
elementEnhancedHTMLElement(Optional) 全屏目标元素,默认是 body
optionsFullscreenOptions(Optional) 全屏选项,可选

Returns:

Promise<void>