How can I make my NuxtJS transition layout specific and not global?How can I upload files asynchronously?How can I merge properties of two JavaScript objects dynamically?How can I convert a string to boolean in JavaScript?How to insert an item into an array at a specific index (JavaScript)?How can I know which radio button is selected via jQuery?How can I get query string values in JavaScript?How do I make the first letter of a string uppercase in JavaScript?How can I select an element with multiple classes in jQuery?How can I pretty-print JSON using JavaScript?How can I refresh a page with jQuery?

Can a stoichiometric mixture of oxygen and methane exist as a liquid at standard pressure and some (low) temperature?

How to cover method return statement in Apex Class?

Can I still be respawned if I die by falling off the map?

Why Shazam when there is already Superman?

How do you make your own symbol when Detexify fails?

Strong empirical falsification of quantum mechanics based on vacuum energy density

Angel of Condemnation - Exile creature with second ability

What happens if you are holding an Iron Flask with a demon inside and walk into an Antimagic Field?

Why does the Sun have different day lengths, but not the gas giants?

Why did the EU agree to delay the Brexit deadline?

Can disgust be a key component of horror?

Can a College of Swords bard use a Blade Flourish option on an opportunity attack provoked by their own Dissonant Whispers spell?

How does the math work for Perception checks?

Creepy dinosaur pc game identification

How does a computer interpret real numbers?

Can I say "fingers" when referring to toes?

It grows, but water kills it

Can a Canadian Travel to the USA twice, less than 180 days each time?

What is going on with 'gets(stdin)' on the site coderbyte?

Limits and Infinite Integration by Parts

Pre-mixing cryogenic fuels and using only one fuel tank

How could a planet have erratic days?

What does chmod -u do?

Is there an injective, monotonically increasing, strictly concave function from the reals, to the reals?



How can I make my NuxtJS transition layout specific and not global?


How can I upload files asynchronously?How can I merge properties of two JavaScript objects dynamically?How can I convert a string to boolean in JavaScript?How to insert an item into an array at a specific index (JavaScript)?How can I know which radio button is selected via jQuery?How can I get query string values in JavaScript?How do I make the first letter of a string uppercase in JavaScript?How can I select an element with multiple classes in jQuery?How can I pretty-print JSON using JavaScript?How can I refresh a page with jQuery?













2















Okay so I have been trying to wrap my head around this for such as longtime now so I've turned to Stack Overflow for help! Essentially, I am using NuxtJS as the frontend framework for a website I'm building for a client. I have a transition property in my Nuxt.config.js file



Nuxt.config.js



transition: 
mode: 'out-in',
css: false,
beforeEnter: function(el)
console.log('Pre Enter');
TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
,
enter: function (el, done)
console.log('Enter');
TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
done()
,
beforeLeave: function (el)
console.log('Before Leave');
TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
,
leave: function (el, done)
console.log(' Leave');
var done = done;
TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

,


I am wanting to move this code inside one of my Layouts since, I need this transition to be layout specific rather than global. I've tried moving this inside one of my layouts by doing the below. However, this didn't work? Is this even possible? I found a git feature request on the Nuxt JS Github page however, the issue has been closed https://github.com/nuxt/nuxt.js/issues/1054



<script> 
export default
transition:
mode: 'out-in',
css: false,
beforeEnter: function(el)
console.log('Pre Enter');
TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
,
enter: function (el, done)
console.log('Enter');
TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
done()
,
beforeLeave: function (el)
console.log('Before Leave');
TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
,
leave: function (el, done)
console.log(' Leave');
var done = done;
TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

,


</script>









share|improve this question




























    2















    Okay so I have been trying to wrap my head around this for such as longtime now so I've turned to Stack Overflow for help! Essentially, I am using NuxtJS as the frontend framework for a website I'm building for a client. I have a transition property in my Nuxt.config.js file



    Nuxt.config.js



    transition: 
    mode: 'out-in',
    css: false,
    beforeEnter: function(el)
    console.log('Pre Enter');
    TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
    TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
    ,
    enter: function (el, done)
    console.log('Enter');
    TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
    TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
    done()
    ,
    beforeLeave: function (el)
    console.log('Before Leave');
    TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
    ,
    leave: function (el, done)
    console.log(' Leave');
    var done = done;
    TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
    TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

    ,


    I am wanting to move this code inside one of my Layouts since, I need this transition to be layout specific rather than global. I've tried moving this inside one of my layouts by doing the below. However, this didn't work? Is this even possible? I found a git feature request on the Nuxt JS Github page however, the issue has been closed https://github.com/nuxt/nuxt.js/issues/1054



    <script> 
    export default
    transition:
    mode: 'out-in',
    css: false,
    beforeEnter: function(el)
    console.log('Pre Enter');
    TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
    TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
    ,
    enter: function (el, done)
    console.log('Enter');
    TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
    TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
    done()
    ,
    beforeLeave: function (el)
    console.log('Before Leave');
    TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
    ,
    leave: function (el, done)
    console.log(' Leave');
    var done = done;
    TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
    TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

    ,


    </script>









    share|improve this question


























      2












      2








      2








      Okay so I have been trying to wrap my head around this for such as longtime now so I've turned to Stack Overflow for help! Essentially, I am using NuxtJS as the frontend framework for a website I'm building for a client. I have a transition property in my Nuxt.config.js file



      Nuxt.config.js



      transition: 
      mode: 'out-in',
      css: false,
      beforeEnter: function(el)
      console.log('Pre Enter');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
      TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
      ,
      enter: function (el, done)
      console.log('Enter');
      TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
      TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
      done()
      ,
      beforeLeave: function (el)
      console.log('Before Leave');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
      ,
      leave: function (el, done)
      console.log(' Leave');
      var done = done;
      TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
      TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

      ,


      I am wanting to move this code inside one of my Layouts since, I need this transition to be layout specific rather than global. I've tried moving this inside one of my layouts by doing the below. However, this didn't work? Is this even possible? I found a git feature request on the Nuxt JS Github page however, the issue has been closed https://github.com/nuxt/nuxt.js/issues/1054



      <script> 
      export default
      transition:
      mode: 'out-in',
      css: false,
      beforeEnter: function(el)
      console.log('Pre Enter');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
      TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
      ,
      enter: function (el, done)
      console.log('Enter');
      TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
      TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
      done()
      ,
      beforeLeave: function (el)
      console.log('Before Leave');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
      ,
      leave: function (el, done)
      console.log(' Leave');
      var done = done;
      TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
      TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

      ,


      </script>









      share|improve this question
















      Okay so I have been trying to wrap my head around this for such as longtime now so I've turned to Stack Overflow for help! Essentially, I am using NuxtJS as the frontend framework for a website I'm building for a client. I have a transition property in my Nuxt.config.js file



      Nuxt.config.js



      transition: 
      mode: 'out-in',
      css: false,
      beforeEnter: function(el)
      console.log('Pre Enter');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
      TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
      ,
      enter: function (el, done)
      console.log('Enter');
      TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
      TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
      done()
      ,
      beforeLeave: function (el)
      console.log('Before Leave');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
      ,
      leave: function (el, done)
      console.log(' Leave');
      var done = done;
      TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
      TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

      ,


      I am wanting to move this code inside one of my Layouts since, I need this transition to be layout specific rather than global. I've tried moving this inside one of my layouts by doing the below. However, this didn't work? Is this even possible? I found a git feature request on the Nuxt JS Github page however, the issue has been closed https://github.com/nuxt/nuxt.js/issues/1054



      <script> 
      export default
      transition:
      mode: 'out-in',
      css: false,
      beforeEnter: function(el)
      console.log('Pre Enter');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 0)
      TweenMax.set(".transition-layer--text h2 span", opacity:0.75, yPercent:0,force3D:true);
      ,
      enter: function (el, done)
      console.log('Enter');
      TweenMax.to(".transition-layer--text h2 span", 0.5, opacity:0.75, yPercent:-100, delay:0.4, ease:Power3.easeInOut, force3D:true, 0.2);
      TweenMax.to(".transition--layer", .75, delay:1, yPercent: -100, ease: Power3.easeInOut)
      done()
      ,
      beforeLeave: function (el)
      console.log('Before Leave');
      TweenMax.set(".transition--layer", transformOrigin: '100% 0%', yPercent: 100)
      ,
      leave: function (el, done)
      console.log(' Leave');
      var done = done;
      TweenMax.to(".transition--layer", .75, yPercent: 0, ease: Power3.easeInOut)
      TweenMax.fromTo(".transition-layer--text h2 span", 0.5, opacity:0, yPercent:100, force3D:true, delay:0.75, ease:Power3.easeInOut, opacity:0.75, yPercent:0,force3D:true, onComplete: function () console.log('leave'); done() , 0.2);

      ,


      </script>






      javascript vue.js transition nuxt.js gsap






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 7 at 6:35









      Jodast

      1




      1










      asked Mar 5 at 11:36









      Gareth JonesGareth Jones

      10311




      10311






















          1 Answer
          1






          active

          oldest

          votes


















          1














          It is actually quite easy to have different transitions for different layouts. I will say this with the caveat that I can make it work with what I know, which is basic old vanilla css and I really have no idea what your TweenMax and so forth up above is doing. I will show you an example of how I do it and I'm sure you'll be able to tailor it to your needs.



          If I want a universal transition I'd set it up like this:



          //nuxt.config.js
          transition:

          name: 'fade',
          mode: 'out-in'
          ,


          and a global css file, let's say main.css



          //main.css
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);




          Now if I want to tailor a transition to a specific layout I'll remove the styles from main.css and put them in the style section of the layout file:



          //default.vue
          <style>
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);


          ...
          </style>


          Each layout file must keep the naming set up in nuxt.config but otherwise it works fine. The only limitation is there is no transition if going from one layout to another.






          share|improve this answer























          • I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

            – Gareth Jones
            Mar 7 at 14:53






          • 1





            @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

            – Andrew1325
            Mar 8 at 22:46











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55001934%2fhow-can-i-make-my-nuxtjs-transition-layout-specific-and-not-global%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          It is actually quite easy to have different transitions for different layouts. I will say this with the caveat that I can make it work with what I know, which is basic old vanilla css and I really have no idea what your TweenMax and so forth up above is doing. I will show you an example of how I do it and I'm sure you'll be able to tailor it to your needs.



          If I want a universal transition I'd set it up like this:



          //nuxt.config.js
          transition:

          name: 'fade',
          mode: 'out-in'
          ,


          and a global css file, let's say main.css



          //main.css
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);




          Now if I want to tailor a transition to a specific layout I'll remove the styles from main.css and put them in the style section of the layout file:



          //default.vue
          <style>
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);


          ...
          </style>


          Each layout file must keep the naming set up in nuxt.config but otherwise it works fine. The only limitation is there is no transition if going from one layout to another.






          share|improve this answer























          • I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

            – Gareth Jones
            Mar 7 at 14:53






          • 1





            @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

            – Andrew1325
            Mar 8 at 22:46
















          1














          It is actually quite easy to have different transitions for different layouts. I will say this with the caveat that I can make it work with what I know, which is basic old vanilla css and I really have no idea what your TweenMax and so forth up above is doing. I will show you an example of how I do it and I'm sure you'll be able to tailor it to your needs.



          If I want a universal transition I'd set it up like this:



          //nuxt.config.js
          transition:

          name: 'fade',
          mode: 'out-in'
          ,


          and a global css file, let's say main.css



          //main.css
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);




          Now if I want to tailor a transition to a specific layout I'll remove the styles from main.css and put them in the style section of the layout file:



          //default.vue
          <style>
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);


          ...
          </style>


          Each layout file must keep the naming set up in nuxt.config but otherwise it works fine. The only limitation is there is no transition if going from one layout to another.






          share|improve this answer























          • I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

            – Gareth Jones
            Mar 7 at 14:53






          • 1





            @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

            – Andrew1325
            Mar 8 at 22:46














          1












          1








          1







          It is actually quite easy to have different transitions for different layouts. I will say this with the caveat that I can make it work with what I know, which is basic old vanilla css and I really have no idea what your TweenMax and so forth up above is doing. I will show you an example of how I do it and I'm sure you'll be able to tailor it to your needs.



          If I want a universal transition I'd set it up like this:



          //nuxt.config.js
          transition:

          name: 'fade',
          mode: 'out-in'
          ,


          and a global css file, let's say main.css



          //main.css
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);




          Now if I want to tailor a transition to a specific layout I'll remove the styles from main.css and put them in the style section of the layout file:



          //default.vue
          <style>
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);


          ...
          </style>


          Each layout file must keep the naming set up in nuxt.config but otherwise it works fine. The only limitation is there is no transition if going from one layout to another.






          share|improve this answer













          It is actually quite easy to have different transitions for different layouts. I will say this with the caveat that I can make it work with what I know, which is basic old vanilla css and I really have no idea what your TweenMax and so forth up above is doing. I will show you an example of how I do it and I'm sure you'll be able to tailor it to your needs.



          If I want a universal transition I'd set it up like this:



          //nuxt.config.js
          transition:

          name: 'fade',
          mode: 'out-in'
          ,


          and a global css file, let's say main.css



          //main.css
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);




          Now if I want to tailor a transition to a specific layout I'll remove the styles from main.css and put them in the style section of the layout file:



          //default.vue
          <style>
          .fade-enter-active
          animation: acrossIn .30s ease-out both;

          .fade-leave-active
          animation: acrossOut .30s ease-in both;

          @keyframes acrossIn
          0%
          transform: translate3d(-100%, 0, 0);

          100%
          transform: translate3d(0, 0, 0);


          @keyframes acrossOut
          0%
          transform: translate3d(0, 0, 0);

          100%
          transform: translate3d(100%, 0, 0);


          ...
          </style>


          Each layout file must keep the naming set up in nuxt.config but otherwise it works fine. The only limitation is there is no transition if going from one layout to another.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 4:36









          Andrew1325Andrew1325

          565310




          565310












          • I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

            – Gareth Jones
            Mar 7 at 14:53






          • 1





            @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

            – Andrew1325
            Mar 8 at 22:46


















          • I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

            – Gareth Jones
            Mar 7 at 14:53






          • 1





            @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

            – Andrew1325
            Mar 8 at 22:46

















          I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

          – Gareth Jones
          Mar 7 at 14:53





          I understand where you are coming from and in terms of CSS this works fine. However, from a Javascript point of view ( TweenMax ), how would I set up different Javascript transitions in different layouts? Because I can't just remove the global transition and use it in a specific layout, since it does not work unfortunately.

          – Gareth Jones
          Mar 7 at 14:53




          1




          1





          @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

          – Andrew1325
          Mar 8 at 22:46






          @GarethJones maybe have a look at this. Seems to doing what you want using gsap on single pages.

          – Andrew1325
          Mar 8 at 22:46




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55001934%2fhow-can-i-make-my-nuxtjs-transition-layout-specific-and-not-global%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко