Skip to content

Commit 86be49f

Browse files
committed
replace svelte-scrollto with svelte-scrolling
1 parent 869f04c commit 86be49f

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

package-lock.json

+8-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"prettier-plugin-svelte": "^3.2.7",
6464
"svelte": "^4.2.19",
6565
"svelte-check": "^4.0.5",
66-
"svelte-scrollto": "0.2.0",
66+
"svelte-scrolling": "^1.4.0",
6767
"tslib": "^2.7.0",
6868
"typescript": "~5.6.3",
6969
"typescript-eslint": "^8.8.1",

src/routes/+page.svelte

+9-10
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,16 @@ import goGameImage from '$lib/assets/gogame.webp';
77
import shogiImage from '$lib/assets/shogi.webp';
88
import tictactoeImage from '$lib/assets/tic-tac-toe.webp';
99
10-
import { scrollTo } from 'svelte-scrollto';
10+
import { scrollRef, scrollTo } from 'svelte-scrolling';
11+
import type { ScrollToOptions } from 'svelte-scrolling/dist/types/options';
1112
1213
let footerHeight: number;
1314
14-
const scrollToAbout = (): void => {
15-
scrollTo({
16-
element: '#about',
17-
offset: -64,
18-
duration: 1500
19-
});
20-
};
15+
const scrollToAbout = {
16+
ref: 'about',
17+
offset: 0,
18+
duration: 1500
19+
} satisfies ScrollToOptions;
2120
</script>
2221

2322
<svelte:head>
@@ -33,12 +32,12 @@ const scrollToAbout = (): void => {
3332
<LogoTitleRowWhite
3433
styles="width: 100%; max-width: var(--contents-width-text); margin: 0 10px 20vh 10px; z-index: 1;"
3534
/>
36-
<a data-sveltekit-noscroll href="/#about" on:click={scrollToAbout} class="btn_03">
35+
<a data-sveltekit-noscroll href="/#about" use:scrollTo={scrollToAbout} class="btn_03">
3736
<span>Start</span>
3837
</a>
3938
</header>
4039

41-
<section id="about">
40+
<section id="about" use:scrollRef={'about'}>
4241
<h1 class="section-title">About</h1>
4342
<p>
4443
Quantum Game Arena

0 commit comments

Comments
 (0)