Skip to content
Snippets Groups Projects
Commit 46fda351 authored by Olivia206's avatar Olivia206
Browse files

added wheel event

parent 93a673f4
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ class DraggableBlock {
}
this.handlePointers();
this.handleScroll();
}
resize () {
......@@ -95,6 +96,20 @@ class DraggableBlock {
});
}
handleScroll() {
this.content.addEventListener('wheel', (event) => {
const delta = event.deltaX;
if (delta !== 0) {
if (delta > 0) {
this.goTo(this.index+1);
} else {
this.goTo(this.index-1);
}
}
});
}
onManipulationEnd (start, end, threshold) {
if (start > end + threshold) {
this.goTo(this.index+1);
......@@ -136,5 +151,5 @@ class DraggableBlock {
}
draggableBlocks.forEach((block) => {
new draggableBlock(block);
new DraggableBlock(block);
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment