A
A
aweui2019-01-12 15:26:41
Vue.js
aweui, 2019-01-12 15:26:41

Wheel up/down event in vue?

Good afternoon!
Vue.js can "listen" to the @wheel event .
Is it possible to track scrolling up and down with the mouse wheel?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2019-01-12
@aweui

When the @whell event is called, the WheelEvent event object is passed, it has a deltaY property, it just indicates where the mouse is spinning. If the number is positive, but the wheel is spinning down, if negative - up.
Example
there you can instead of assigning this.pos, put a call to your methods wheelUp, wheelDown.
UPD: to prevent the browser window from scrolling, you can add .prevent events to the definition

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question