Skip to content

Commit

Permalink
feat: gup single slide hooper
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDorr committed Jun 18, 2020
1 parent a200d1e commit 3e871e6
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,22 +462,27 @@ export default {
this.slidePrev();
}
},

// Start custom package code
// -------------------------------------------------
onWheel(event) {
event.preventDefault();
if (now() - this.lastScrollTime < 200) {
return;
// get wheel direction
const value = event.wheelDelta || -event.deltaY;
const delta = sign(value);
if (delta === -1) {
this.slideNext();
}
if (delta === 1) {
this.slidePrev();
}
}
// get wheel direction
this.lastScrollTime = now();
const value = event.wheelDelta || -event.deltaY;
const delta = sign(value);
if (delta === -1) {
this.slideNext();
}
if (delta === 1) {
this.slidePrev();
}
},
// -------------------------------------------------
// end custom package code

addGroupListeners() {
if (!this.group) {
return;
Expand Down

0 comments on commit 3e871e6

Please sign in to comment.