Skip to content
Snippets Groups Projects
Commit 495fcc34 authored by Olivia206's avatar Olivia206
Browse files

simplify

parent 57daa0cd
No related branches found
No related tags found
No related merge requests found
......@@ -60,18 +60,10 @@ class DraggableBlock {
this.goTo(this.index-1);
});
this.previous.addEventListener('pointerup', () => {
this.isPointerDown = false;
});
this.next.addEventListener('click', () => {
this.clicOnBtn = true;
this.goTo(this.index+1);
});
this.next.addEventListener('pointerup', () => {
this.isPointerDown = false;
});
}
handlePointers () {
......@@ -101,10 +93,9 @@ class DraggableBlock {
});
this.block.addEventListener('pointerup', (event) => {
endX = event.clientX;
if (this.isPointerDown) {
this.isPointerDown = false;
this.content.classList.remove('is-grabbing');
const endX = event.clientX;
this.onManipulationEnd(startX, endX, threshold);
}
});
......@@ -133,7 +124,8 @@ class DraggableBlock {
} else if (start < end - threshold) {
this.goTo(this.index-1);
}
this.clicOnBtn = true;
this.clicOnBtn = false;
this.content.classList.remove('is-grabbing');
this.items.forEach((item) => {
item.style.pointerEvents = "all";
......
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