Skip to content

Commit 46add68

Browse files
committed
feat: add ScrollToEnd hook for automatic horizontal scrolling
- Implemented ScrollToEnd hook with mounted and updated lifecycle methods - Ensures the element scrolls to the end on mount and update events
1 parent 0b810e9 commit 46add68

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

assets/js/app.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ const Hooks = {
5555
posthog.identify(email, { email });
5656
},
5757
},
58+
ScrollToEnd: {
59+
mounted() {
60+
requestAnimationFrame(() => {
61+
this.el.scrollLeft = this.el.scrollWidth;
62+
});
63+
},
64+
updated() {
65+
requestAnimationFrame(() => {
66+
this.el.scrollLeft = this.el.scrollWidth;
67+
});
68+
},
69+
},
5870
Flash: {
5971
mounted() {
6072
let hide = () =>

0 commit comments

Comments
 (0)