Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Roman Baranov

Destroy scrollerProxy

Recommended Posts

Hello everyone, thanks guys for gsap and all about it. I use barba + locomotive + gsap on my project, i try to destroy all ScrollTriggers with 

ScrollTrigger.getAll().forEach((trigger) => trigger.kill());

But i have some errors from ScrollerProxy, and i think my code doesnt destroy all ScrollTriggers, especially scrollerProxy.

There my code for scrollerProxy, almost duplicate from docs

if (scrollContainer) {
        window.locoInstance.on('scroll', ScrollTrigger.update);
        ScrollTrigger.scrollerProxy(scrollContainer, {
            scrollTop(value) {
                return arguments.length ? window.locoInstance.scrollTo(value, 0, 0) : window.locoInstance.scroll.instance.scroll.y;
            },
            getBoundingClientRect() {
                return { top: 0, left: 0, width: window.innerWidth, height: window.innerHeight };
            },
            pinType: scrollContainer.style.transform ? 'transform' : 'fixed',
        })
    }

There error

Uncaught TypeError: Cannot read property 'scroll' of null
    at ScrollTrigger.scrollTop [as scroll]
    at _updateAll 

Sorry for my english, sorry it's not codepen, and if it's something stupid, i just tired and don't know why and how to fix this, thanks

Link to comment
Share on other sites

Hey Roman and welcome to the GreenSock forums.

 

It's really hard to debug blindly. Can you please make a minimal demo of the issue?

 

  • Like 1
Link to comment
Share on other sites

21 hours ago, ZachSaucier said:

Hey Roman and welcome to the GreenSock forums.

 

It's really hard to debug blindly. Can you please make a minimal demo of the issue?

 

I'm not sure, how i can use barba on codepen, where shoul redirect links, but i don't ask for debug, main question its how i can fully destroy script for scrollerProxy

Link to comment
Share on other sites

It looks like you might be using Locomotive Scroll? So is your question how to kill the Locomotive Scroll instance? It has a .destroy() method if so.

 

If that's not what you're looking for I don't understand what you are looking for. A demo would help us understand and better be able to help. 

  • Like 1
Link to comment
Share on other sites

13 hours ago, ZachSaucier said:

It looks like you might be using Locomotive Scroll? So is your question how to kill the Locomotive Scroll instance? It has a .destroy() method if so.

 

If that's not what you're looking for I don't understand what you are looking for. A demo would help us understand and better be able to help. 

Im use barba first time, and i think my scripts failed w/o errors on console, and locomotive doesnt destroy because script failed before destroy, and I get some scrollTrigger errors, and think I need destroy locomotive scroll and scrollerProxy, thank you for help, i'm just confused, but now I found reasons why I get this errors

Link to comment
Share on other sites

  • 2 weeks later...

You may create a project with two or more pages in codepen. Create a demo, I am also interested in this issue.

On 16.10.2020 at 06:31, Roman Baranov said:

Я использую barba в первый раз, и я думаю, что мои скрипты не прошли без ошибок на консоли, а локомотив не уничтожается, потому что скрипт завершился неудачно до уничтожения, и я получаю некоторые ошибки scrollTrigger и думаю, что мне нужно уничтожить прокрутку локомотива и scrollerProxy, спасибо за помощь , я просто запутался, но теперь я нашел причины, по которым у меня появляются эти ошибки

 

Link to comment
Share on other sites

Hey guys, helpless me again :D

 

I´ve made this codepen to abstract my problem, which solves my initial problem of disabling multiple gsap-instances when switched to some other scroll reference. very useful!

Now I´m facing quite the same issue as described above, but by using asscroll library.

In the example it´s not refreshing the gsap params if you open the overlay by clicking one of these boxes.

 

See the Pen yLJKBpw by rkxn (@rkxn) on CodePen

 

Can you please check if this is the right way to implement scrollerProxy?

 

stay safe,

Best,

Richard

 

Link to comment
Share on other sites

Hey Richard. You created a scrollerProxy for the smooth-scroll element but your overlays have their own scroller. So you need to create a scrollerProxy for those as well:

See the Pen ExyLBvP?editors=0010 by GreenSock (@GreenSock) on CodePen

  • Like 2
Link to comment
Share on other sites

15 hours ago, ZachSaucier said:

Hey Richard. You created a scrollerProxy for the smooth-scroll element but your overlays have their own scroller. So you need to create a scrollerProxy for those as well:

 

oh , :D so close. absolutely smashing how good gsap and you guys performing at this ❤️

thanks for the fast answer!

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

×