Jump to content
Search Community

Pin section flickering with Scrolltrigger and smooth-scrollbar

kosmo test
Moderator Tag

Go to solution Solved by kosmo,

Recommended Posts

Hello all :),

 

I'm on a new version of our site for the agency.

 

We currently have this library in addition to GSAP, scrolltrigger etc: https://github.com/idiotWu/smooth-scrollbar

 

I have a section on home where I pin using Scrolltrigger, except I get flickering when I scroll and I can't fix it.

 

I read all the topics that were related to this problem (https://greensock.com/forums/topic/26008-scrolltrigger-flickering-when-pinned/)

 

I can not understand where the problem comes from because I put the right thing.

 

I made a video for you to see because the site is local : https://e-kosmo.com/problem-pin.mp4

 

pinType > fixed doesnt work

pinType > 'transform' work with flickering

 

ScrollTrigger.create({
            trigger: this.$target,
            refreshPriority: 0,
            invalidateOnRefresh: true,
            pin: this.$wrapper,
            pinType: typeof window.SB !== 'undefined' ? 'transform' : 'fixed',
            //pinType: document.querySelector(".scroll-content").style.transform ? "transform" : "fixed",
            //pinType: 'fixed',
            pinSpacing: 'margin',
            anticipatePin: 1,
            scrub: 0.5,
            start: "bottom bottom",
            end: '+=2700',
        });

 

 

Thank you in advance for your help and feedback

 

Nickolas

Link to comment
Share on other sites

  • Solution

Hello @Shaun Gorneau and all,

 

I found my problem ;) So here is what I did :

 

ScrollTrigger.create({
            trigger: this.$target,
            //refreshPriority: 0,
            invalidateOnRefresh: true,
            pin: this.$wrapper,
            //pinType: typeof window.SB !== 'undefined' ? 'transform' : 'fixed',
            //pinType: document.querySelector(".scroll-content").style.transform ? "transform" : "fixed",
            pinType: "transform",
            //pinSpacing: 'padding',
            preventOverlaps: true,
            anticipatePin: 1,
            scrub: 0.5,
            start: "bottom bottom",
            end: '+=2700',
            //end: () => "+=" + innerHeight,
            markers: true,
            onEnter: function () {
                window.SB.setMomentum(0, 0);
                window.SB.options.damping = 10;
            },
            onEnterBack: function () {
                window.SB.setMomentum(0, 0);
                window.SB.options.damping = 10;
            },
            onLeave: function () {
                window.SB.options.damping = 0.12;
            },
        });

I realized that with the value at 10 in damping my problem disappeared.

 

So i paused smoothscrollbar by re-entering the section once scrolltrigger throws the pin.

 

And the same when you get back into the section :)

 

Thank you

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