Scrolling directive

The v-scroll directive allows you to provide callbacks when the window or a specifically defined element are scrolled.

Usage

The default behavior is to bind to the window. If no additional configuration options are needed, you can simply pass your callback function.

API

v-scroll
Name
arg:target
Default
window
Type
String

v-scroll:#target="callback" The target watched for scroll changes. Defaults to window but can be changed to any valid id selector.

Name
value
Signature
() => {}
Type
Function

v-scroll="callback" The function to invoke on target scroll

Examples

Scroll with options

For a more fine tuned approach, you can designate the target to bind the scroll event listener.

Edit this page | language on Github