mirror of
https://github.com/Tooloop/Tooloop-Packages.git
synced 2026-04-27 20:41:37 +02:00
[Onboarding] add keyboard shortcuts
This commit is contained in:
@@ -77,6 +77,15 @@ class Slider {
|
|||||||
// observe scroll position
|
// observe scroll position
|
||||||
this.element.onscroll = e => this.onScroll(e);
|
this.element.onscroll = e => this.onScroll(e);
|
||||||
|
|
||||||
|
// keyboard shortcuts
|
||||||
|
document.addEventListener("keydown", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
document.addEventListener("keyup", (e) => {
|
||||||
|
if (e.code === "ArrowLeft") this.previous();
|
||||||
|
if (e.code === "ArrowRight") this.next();
|
||||||
|
});
|
||||||
|
|
||||||
// start auto play
|
// start auto play
|
||||||
this.startTimeout();
|
this.startTimeout();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user