Jump to content
Search Community

steen hjalmar larsen

Members
  • Posts

    19
  • Joined

  • Last visited

Posts posted by steen hjalmar larsen

  1. Thanks again for your nice reply

    Unfortunately, your fine suggestions did not solve my problem.

    After some exploration, I can see that a resize event handler is created from the scrollTrigger, which continues to be found on subsequent pages.
    On my front page I get from inspect
    getEventListeners(window).resize.forEach((elm)=>{console.log(elm)})
    VM12085:1 {useCapture: false, passive: false, once: false, type: 'resize', listener: ƒ}
    VM12085:1 {useCapture: false, passive: true, once: false, type: 'resize', listener: ƒ}

    It seems that it is the event handler with "passive: true" that is causing trouble.
     

    I can remove it in the inspect window on the other pages and that solves the problem
    getEventListeners(window).resize.forEach((elm)=>{if(elm.passive === true){removeEventListener('resize', elm.listener)}})
    but unfortunately I can't get this code to work in React

     

    In React I can't use "getEventListeners(window)" react claims that getEventListeners is not a function?

  2. Having problems with killing scrollTrigger on mobile when i shifting between different pages. It works fine on desktop. 

    Have set up a pen where it actually works, but when I do the same on my online site it doesn't work

    Link: pen

    Link: my site

    Has anyone had similar problems and possibly found a solution

  3. What I'm looking for is
    1. When the page is loaded and the user has not yet scrolled down to the horizontal scroll, nothing happens
    2. When the user scrolls down to the horizontal scroll window and the horizontal animation starts, it is registered
    2.1 When Panel 1 is in focus, I get information that panel is active (console.log(panel.id)
    2.2 The same happens with the rest of the panels

    The example that Jack shows works a little better, but also has errors. e.g. if I scroll to panel 2 but undo my scroll and scroll back then it will not be registered? and then I also get feedback here that I am at panel 1 when the page is loaded

  4. Unfortunately didn't quite understand your suggestion iDad5, could you make a pin as an example, on the other hand the pin that Cassie has created seems to work fine
    Thank you both, have spent a whole day without finding a good solution.
    Was thinking about using onUpdate, but couldn't get it to be dynamic

     

    gsap.timeline({
                scrollTrigger: {
                    onUpdate: (self) => {
                        let breackPoint = [0, 0.33, 0.66, 1];
                        let thisProgress = Number(self.progress.toFixed(3));
                        if (thisProgress > 0 && thisProgress < breackPoint[1]) {
                            console.log("first-inteval");
                        }
                    },
  5. Hi Cassie
    Thanks for the quick response
    I have two panels with class="container-panel" both of which I would like to animate with ScrollTrigger
    One panel is at the top of the page, the other at the bottom
    The problem is that only the first one gets animated

  6. Trying to build a horizontal and a vertical scrollTrigger
    1.The first scrollTrigger ".container-panel" should animate two div box vertically
    2. The next scrollTrigger ".panel-wrapper" should animate a row of boxes horizontally
    The horizontal animation works fine, but the vertical animates only the first box?
    What am I doing wrong?

    Incidentally, I have a little doubt about what is best in practice in relation to the horizontal scrollTrigger's end property
    a. than: "+=3500"
    b. end: "+=" + panel.reduce((p, c) => p + c.offsetWidth, 0)

    See the Pen abYVYJz?editors=1111 by shl (@shl) on CodePen

  7. 15 hours ago, GreenSock said:

    Actually that isn't true - look at the console: 

     

     

    You are right that there is a difference in what is registered as a parent node
    In Vanilla JS it is "#root", while in React it is first "#root" and then it changes to ".pin-spacer"
    Can see that GSAP changes the DOM

     

    THANK YOU once again for your responsec 💕

    • Like 2
  8. Yes I have looked at quite a few of the examples from
    "Getting Started with GSAP + React" and "GSAP + React, Advanced Animation Techniques"
    but have not been able to find any solution to my problem.
    It seems strange that my React code does not work as all DOM elements are loaded when I use useEffect

×
×
  • Create New...