Jump to content
Search Community

about animations in specific breakpoints only and resetting inline styles around them

emjay test
Moderator Tag

Recommended Posts

Hello GSAP friends,


in my pen you can see a navigation that opens from the right side on mobile and should be displayed normally on desktop. The animation for mobile works as expected, but I have problems to make the navigation visible on desktop because of the inline styles set by gsap.
If you expand the navigation and drag the viewport larger the navigation remains visible because the inline styles are correct in this case. But in the default state the navigation is not visible because of inline styles like opacity = 0.


Do you have a tip for me, how I should either remove the inline styles or leave the animation active only in a breakpoint?

In the attached gif you can see how the nav should look like on desktop and mobile.  (gsap was commented out for this gif).


Thanks in advance for your help.

gsap.gif

See the Pen 32720be00ceed8c048fa9120bc5d1167 by emjay (@emjay) on CodePen

Link to comment
Share on other sites

var menuAnimation = gsap.timeline({
    paused:true,
    reversed:true,
    ease: "power3.inOut",
    defaults: {
    immediateRender: false
    }
});

 

The .from is setting autoAlpha before the animation has started. Usually a very good thing.

You can override this by setting immediateRender: false.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...