Jump to content
Search Community

Observer ignoring "ignore" parameter?

foundartfactory test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Howdy folks! I went looking for ScrollTrigger stuff, and came across Observer which may be all I need. I was trying to use the ignore parameter, but it doesn't appear to affect anything. Ideas as to what I'm not doing correctly? 

In my HTML I have something like:

<section class="second scrollignore"> //(i've tried putting the class on the div, etc)

...and in the Javascript:

Observer.create({
        type: "wheel,touch,pointer",
        wheelSpeed: -1,
        onDown: () => {
          !animating && gotoSection(currentIndex - 1, -1);
        },
        onUp: () => {
          !animating && gotoSection(currentIndex + 1, 1);
        },
        tolerance: 10,
        preventDefault: true,
        ignore: ".scrollignore"
      });

I should note -- I was working from the original example found in https://greensock.com/docs/v3/Plugins/Observer; When I went to that page today, there's a similar looking but very different under the hood example there. Consider me confused! :)

 

Thanks,

Patrick

See the Pen qBxxrNw by foundartfactory (@foundartfactory) on CodePen

Link to comment
Share on other sites

  • Solution

I'm not 100% sure as I didn't build that demo, but all the sections are stacked on top of each other so this may be a target/z-index issue. If you add the .ignore class to the header, you see it is indeed ignored.

 

Here's another simple example where I've told the Observer to ignore the .green and .orange targets.

See the Pen cd77c0fbf45bc990d3baf4213529e43f by PointC (@PointC) on CodePen

 

You can see that the ignore works exactly as expected. I didn't have much time to dive too deep into your forked demo to see the exact reason, but maybe @GreenSock can clarify a little bit.

 

Happy tweening.

:)

  • Like 1
Link to comment
Share on other sites

46 minutes ago, PointC said:

If you add the .ignore class to the header, you see it is indeed ignored.

And you are of course absolutely correct! 🤦🏻‍♂️ Makes perfect sense  :)  

Thanks Craig @PointC for that quick response, advice and fix!

 

Now to think about stacking versus not stacking,

Patrick

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