Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Mouse Wheel Event Scrubs <video> tags
- // usage: scrolling with a mouse on <video> tags scrubs the video
- Array.prototype.slice.call(document.querySelectorAll('video'))
- .forEach(function(tag) {
- return tag.addEventListener(
- 'wheel',
- function(event) {
- var tuning = 7 // fine tune this value between 3-7 to change sensitivity
- return event.target.currentTime =
- event.target.currentTime + ((event.deltaX * -1) + event.deltaY) / tuning
- },
- {
- passive: true
- }
- )
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement