Skip to content

useElementBounding ​

Dynamically obtain the size and coordinates of Dom elements.

Code demonstration ​

API ​

typescript
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 ​

Source · Document · Demo

Released under the MIT License.