Skip to content

Combining JS Plugin and Parallel Plugin #799

Answered by daun
Eric-llos asked this question in Help
Discussion options

You must be logged in to vote

@Eric-llos I've given it a stab and the combination of JS + Parallel Plugin seems to be working fine. You just need to make sure you're grabbing the correct elements and animating both in the in phase of the animation at once:

const swup = new Swup({
  containers: ['main'],
  plugins: [
    new SwupParallelPlugin({ containers: ['main'] }),
    new SwupJSPlugin({
      animations: [
        {
          from: '(.*)',
          to: '(.*)',
          in: async () => {
            const next = document.querySelector('main');
            const prev = document.querySelector('main + main');
            await Promise.all([
              next.animate([{ opacity: 0, transform: 'translateX(100%)' }, {}]

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Eric-llos
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@daun
Comment options

daun Oct 9, 2023
Maintainer

@ercovi
Comment options

@ercovi
Comment options

@daun
Comment options

daun Oct 11, 2023
Maintainer

Comment options

You must be logged in to vote
1 reply
@ercovi
Comment options

Comment options

You must be logged in to vote
1 reply
@daun
Comment options

daun Oct 25, 2023
Maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants