Jump to content
Search Community

NavBar Top and Bottom show/hide

fernandocomet test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

  • Solution

Hi,

 

If is not broken don't fix it right?

 

I will make it shorter though:

var navTop = gsap.to('.navbar', {
  y:'-=100',
  duration:0.3,
  ease:'power2.in',
  scrollTrigger: {
    trigger: ".navbar",
    start: "10px top",
    onEnter: (self) => self.animation.play(),
    onLeaveBack: (self) => self.animation.reverse(),
    markers:true
  }
});

var navBottom = gsap.to('.bottombar', {
  y:'-=100',
  duration:0.3,
  ease:'power2.in',
  scrollTrigger: {
    trigger: ".reference",
    start: "10px bottom",
    onEnter: (self) => self.animation.play(),
    onLeaveBack: (self) => self.animation.reverse(),
    markers:true
  }
});

Beyond that, which is just less code, I can't think of a way to improve this.

 

Happy Tweening!

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...