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

useWindowScroll

Reactive window scroll

Usage

import { useWindowScroll } from '@vueuse/core'

const { x, y } = useWindowScroll()

Type Declarations

/**
 * Reactive window scroll.
 *
 * @link /useWindowScroll
 * @param options
 */
export declare function useWindowScroll({
  window,
}?: ConfigurableWindow): {
  x: Ref<number>
  y: Ref<number>
}

Source

SourceDemoDocs