Skip to content

Commit

Permalink
Disable swiper if swiper hast just one slide, to make it possible to …
Browse files Browse the repository at this point in the history
…slide the menu still, because swiper grabs it else
  • Loading branch information
graphefruit committed Sep 4, 2024
1 parent 55c9c89 commit 2789e45
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/components/brew-information/brew-information.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,24 @@ export class BrewInformationComponent implements OnInit {
this.informationContainerWidth =
this.brewInformationContainer?.nativeElement?.offsetWidth - 50;

/**If we slide on a bigger tablet, somehow ionic triggering the menu when sliding from right to left, thats why we need to attach us to touchstart/end and to ignore the slide...**/
this.brewInformationSlider?.nativeElement.swiper.on(
'touchStart',
() => {
this.menu.swipeGesture(false);
}
);
this.brewInformationSlider?.nativeElement.swiper.on('touchEnd', () => {
this.menu.swipeGesture(true);
});
if (this.brew.flow_profile) {
/**If we slide on a bigger tablet, somehow ionic triggering the menu when sliding from right to left, thats why we need to attach us to touchstart/end and to ignore the slide...**/
this.brewInformationSlider?.nativeElement.swiper.on(
'touchStart',
() => {
//We got two slides
this.menu.swipeGesture(false);
}
);
this.brewInformationSlider?.nativeElement.swiper.on(
'touchEnd',
() => {
this.menu.swipeGesture(true);
}
);
} else {
this.brewInformationSlider?.nativeElement.swiper.disable();
}
}, 150);
}
}
Expand Down

0 comments on commit 2789e45

Please sign in to comment.