Jump to content


Fade out pinned section using scrolltrigger

Moderator Tag
Go to solution Solved by akapowl,

Recommended Posts

I am trying to have an intro section fade out using scrub as you scroll down the page (the viewport height) to reveal the next section under it. 


At the moment it is not pinning and the scrub does not work, where am I going wrong?

See the Pen yLqVvGp by garethworld (@garethworld) on CodePen

Link to comment
Share on other sites

  • Solution


Hello Gareth,



If you want to specify things on the ScrollTrigger attached to a tween, you should be using it as an object and have all the vars relevant to the ScrollTrigger inside that object


gsap.to("#intro", {
  scrollTrigger: {
    trigger: "#content", 
    start: "top top",
    end: screenH,
    scrub: 1,
    pin: true,
  opacity: 0,



Currently you don't have an element with the id of content in your HTML - because the element that you likely meant there has an # in it


<div id="#content"> <-- bad

<div id="content"> <-- better



  • Like 1
Link to comment
Share on other sites

Ah thank you!, I have updated and it's working great. 


Stupid typo! 

<div id="#content"> <--
  • 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.