Skip to content
On this page

useWindowScroll

Category
Last Changed
3 months ago

Reactive window scroll

Demo

See scroll values in the lower right corner of the screen.
Scroll value
x: 0
y: 0

Usage

import { useWindowScroll } from '@vueuse/core'

const { x, y } = useWindowScroll()
import { useWindowScroll } from '@vueuse/core'

const { x, y } = useWindowScroll()

Type Declarations

/**
 * Reactive window scroll.
 *
 * @see https://vueuse.org/useWindowScroll
 * @param options
 */
export declare function useWindowScroll({ window }?: ConfigurableWindow): {
  x: Ref<number>
  y: Ref<number>
}
export declare type UseWindowScrollReturn = ReturnType<typeof useWindowScroll>
/**
 * Reactive window scroll.
 *
 * @see https://vueuse.org/useWindowScroll
 * @param options
 */
export declare function useWindowScroll({ window }?: ConfigurableWindow): {
  x: Ref<number>
  y: Ref<number>
}
export declare type UseWindowScrollReturn = ReturnType<typeof useWindowScroll>

Source

SourceDemoDocs

Contributors

Anthony Fu
Nurettin Kaya
Antério Vieira
Shinigami
Alex Kozack

Changelog

v4.11.2 on 5/30/2021
68c7d - feat(typedef): add return typedefs (#543) (#544)
useWindowScroll has loaded