question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PageTransition JavaScript Hooks problem

See original GitHub issue

Greetings. I ran into a problem when calling javascript transition hooks.

I have reproduced the issue here:

https://stackblitz.com/edit/nuxt-starter-6qvzci?file=pages/second.vue

Can you please tell me if I can assign global transitions for all pages, as it is implemented, for example, in vue router.

<router-view v-slot="{ Component }"> <transition name="fade" mode="out-in"> <component :is="Component" /> </transition> </router-view>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
mak33vcommented, May 9, 2022

Thank you for your answers, thanks to them I have implemented everything I wanted.

@jiblett1000 Thanks to your tip on these hooks, I implemented a java script logic for transitions:

// app.vue const nuxtApp = useNuxtApp() nuxtApp.hook('page:start', () => { .... }) nuxtApp.hook('page:finish', () => { .... })

@derz Your answer helped implement transition properties globally for all pages

2reactions
derzcommented, May 9, 2022

You could use a middleware to do that, for example:

export default defineNuxtRouteMiddleware((to, from) => {
    // don't overwrite default transition...
    if ( to.meta.pageTransition == null) {
        to.meta.pageTransition = {
            name: 'default-transition',
            mode: 'in-out',
        };
    }
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

JS content not working after a page transition using Barba.JS
To get page-specific animations to work from one page to another after a transition, all of those animations have to be reinitialised. You...
Read more >
Advanced Page Transitions in Next.js with Router Events and ...
Next.js allows you to listen to various events in its Router object, these events occur during the lifecycle of a page to page...
Read more >
React Router V6 and Framer Motion Tutorial - YouTube
PAGE TRANSITION ANIMATIONS IN REACT! In this video I will be showing how to use the framer motion library to create page transitions...
Read more >
Barba.js with GSAP - 09. Once, Leave, Enter Hooks - YouTube
Today we cover once, leave and enter hooks. ... 4.3K views 2 years ago Barba. js 101 - Page Transition Tutorials. 4,311 views...
Read more >
Page Transistions in React.js using Framer Motion - Section.io
The useLocation hook will assist the routes in determining the page we are on. We also import the page wrapped with animatedPresence from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found