useFullscreen

A Hook for handling dom full screen.

API is consistent with ahooks.

Examples

Basic usage

Pass in function

API

const [isFullscreen, { setFull, exitFull, toggleFull }] = useFullScreen(target, options?:Options);

Params

PropertyDescriptionTypeDefault
targetDOM element or Ref ObjectHTMLElement | () => HTMLElement
optionssetting(optional)Options-

Options

PropertyDescriptionTypeDefault
onExitFulllisten for exit full screen events()=>void-
onFulllisten for full screen events()=>void-

Result

PropertyDescriptionType
isFullscreenis full screenboolean
setFullset full screen()=>void
exitFullexit full screen()=>void
toggleFulltoggle full screen()=>void

最近更新: