preserve scroll using inertia.render #542
Unanswered
parpar78
asked this question in
Help (Vue)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I've made a javascript transition in Vue when a user goes to another page. Everything works, accept when the animation starts the old page scrolls to the top. Then the animation starts. Then the new page appears.
The problem is that I don't want the old page to scroll to the top when the animation starts. But scroll to the top after the animation is finished.
Is the best use case for this to add preserve-scroll to inertia-link and then scroll to top after the page is loaded? Or does anyone knows a better solution for this?
See my current code below
<template> <main> <transition appear name="fade" @beforeLeave="beforeLeave" > <slot></slot> </transition> <loader :display="loaderDisplay" :size="screenfillsize"></loader> </main> </template>
`<script>
import Loader from './Layout/Loader.vue';
import { Inertia } from '@inertiajs/inertia';
import { gsap } from "gsap";
</script>`
<style lang="css" scoped> @media only screen and (min-width: 992px){ .fade-enter-active, .fade-leave-active { transition-duration: .75s; } } </style>
Beta Was this translation helpful? Give feedback.
All reactions