Skip to content

Commit

Permalink
Merge pull request #407 from hidotmatrix/hidotmatrix/chore/mac_scroll…
Browse files Browse the repository at this point in the history
…_issue

Fixes Mac's Scroll Problem.
  • Loading branch information
wuminzhe authored Apr 8, 2024
2 parents 0160d36 + b7b420d commit 46a1725
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/layouts/HomePageDesktopLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ export default function HomePageDesktopLayout({ children }: PropsWithChildren<un
useEffect(() => {
const listener = (ev: WheelEvent) => {
if (ref.current) {
ref.current.scrollLeft += ev.deltaY * 2;
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if(isMac) {
ref.current.scrollLeft += ev.deltaY * 10;
} else {
ref.current.scrollLeft += ev.deltaY * 2;
}
}
ev.preventDefault();
};
Expand Down

0 comments on commit 46a1725

Please sign in to comment.