Skip to content
Snippets Groups Projects
Commit 3f749c65 authored by syuilo's avatar syuilo
Browse files

良い感じに

parent 2a7d4ee8
No related branches found
No related tags found
No related merge requests found
......@@ -62,11 +62,16 @@ export const router = new VueRouter({
],
// なんかHacky
// 通常の使い方をすると scroll メソッドの behavior を設定できないため、自前で window.scroll するようにする
// setTimeout しないと、アニメーション(トランジション)の関係でうまく動かない
scrollBehavior(to) {
window._scroll = () => { // さらにHacky
if (to.name === 'index') {
window.scroll({ top: indexScrollPos, behavior: 'instant' });
const i = setInterval(() => {
window.scroll({ top: indexScrollPos, behavior: 'instant' });
}, 10);
setTimeout(() => {
clearInterval(i);
}, 500);
} else {
window.scroll({ top: 0, behavior: 'instant' });
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment