Jump to content
Search Community

jshchui

Members
  • Posts

    4
  • Joined

  • Last visited

jshchui's Achievements

  1. I figured it out, the previous scroller value inside the ScrollTrigger.vars was messing it up. To solve it, I had to set the scroller to null ScrollTrigger.create({ ...scrollT.vars, scroller: null })
  2. Thank you so much Jack, the pen you provided worked wonderfully. One last question, in my project I have nested components, each with their own scrollTriggers inside of them. Individually recreating all of them will be very difficult so I was hoping there is a way to recreate all the scrollTriggers inside 'scrollTrigger.getAll()'. Is that possible? I tried to store all the previous scrollTriggers except the scrollProxy one inside an array (previousTriggers) And after I kill all my scrollTriggers and reset the scroll, I want to recreate all the triggers inside 'previousTriggers' by referencing ScrollTrigger.vars: const allTriggers = ScrollTrigger.getAll(); const previousTriggers = [] if(allTriggers.length ) { allTriggers.forEach(scrollT => { const id = scrollT.vars.id; if (id !== 'smoothTrigger') { previousTriggers.push(scrollT); } scrollT.kill() }) } // reset scroll...... previousTriggers.forEach(scrollT => { ScrollTrigger.create({ ...scrollT.vars }) } Recreate scrollTriggers from scrollTrigger.getAll() Unfortunately that doesn't seem to be working, is it possible to recreate a scrollTrigger from a saved scrollTrigger instance? Edit: One thing I did notice again is that if you comment out mySmoother scrollProxy, it works perfectly again. Somehow the scrollProxy is interfering with it again? Thanks again!
  3. Hey thanks for the reply, much appreciated. I do have another question for another idea. I plan to originally start with scroll smoothing and once the user presses tab, I will kill the scroll smoothing, revert it back to the original scroll thus allowing them to tab normally. However, I seem to have a problem to properly revert scroll proxy back to its original native scroll functionality. I found a thread that similarly talks about it: Unfortunately, there wasn't a resolution and I also tried to use the 'ScrollTrigger.scrollerProxy(document.body)' that you suggested, but it still doesn't seem to work I have created another codepen to reflect my problem. problem with removing scrollproxy The goal is to have scroll smoothing initially, but when I press tab, it will kill the scrollproxy, revert back to native scroll, and recreate the scrollTriggers. Box2 and Box4 starts off pinned, but after tabbing, they don't pin anymore. However, it doesn't work with the 'mySmoother' smoothing code. It initially have scroll smoothing, but when I press tab, it seems to revert back to native scroll, but the scrollTriggers that are recreated are not pinning properly. If you comment out 'mySmoother' line, it works perfectly, so I think its something to do with me not clearing up the scroll proxy properly. Any help is appreciated, thanks.
  4. Hello, first off thank you for this wonderful library, it's doing wonders for my current project. I am creating a website that is using a scrolling experience with scrollTrigger. I also added Greensocks example (https://codepen.io/GreenSock/pen/gOgWELo) 'smoothScroll() for ScrollTrigger' as well. It's working great until I start pressing tab to navigate through the buttons / links. I made a codepen to demonstrate the problem. It is tabbing to the correct button, however I noticed the scrollbar isn't moving at all while the screen is going to the buttons. After tabbing you can continue scrolling and it goes down way beyond the container. I tried to force the scrollbar to 'scroll' by adding an "addEventListener('focusin', () =>)" where I get the tabbed target and calculate its Y distance from the body and force scrollTrigger to scroll to the calculated distance. mySmoother.scroll(yOffsetToBody) After that, it sorta is 30% working. It works well when you are at the end and you do 'shift + tab' to go backwards, but just tabbing forwards, it's really wonky. Is there a proper way to get scrollTrigger + smoothScroll work well with tabbing? Any help would be appreciated. I do know that just using the Greensock club's scroll smoother completely solves this problem, but I'm trying to see if this can be resolved without that plugin first. Thank you.
×
×
  • Create New...