Skip to content
On this page

useElementBounding

Dynamically obtain the size and coordinates of Dom elements.

Code demonstration

API

const isHovering = useHover(target, {
  reset?: boolean
  windowResize?: boolean
  windowScroll?: boolean
  immediate?: boolean
})
const isHovering = useHover(target, {
  reset?: boolean
  windowResize?: boolean
  windowScroll?: boolean
  immediate?: boolean
})

Params

PropertyDescriptionTypeDefault
targetDOM element or ref() => Element | Element | JSX.Element-
optionsMore configUseElementBoundingOptions-

Options

参数说明类型默认值
resetWhen the component is mounted, initialize all values to 0booleantrue
windowResizeMonitor window size changesbooleantrue
windowScrollMonitor window scrolling changesbooleantrue
immediateExecuted immediately when the component is mountedbooleantrue

Source

SourceDocsDemo