Jump to content
Search Community

Archimede Soc.Coop.

Premium
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Archimede Soc.Coop.

  1. 56 minutes ago, mvaneijgen said:

    Without any Javascript your panels are 100% width, so it isn't a GSAP problem it an CSS issue. I've broken up your flex: property to there individual parts (read more here https://developer.mozilla.org/en-US/docs/Web/CSS/flex) and if you set flex-basis: 100px (commented out)  they are stacked like you want them to be. Hope it helps and happy tweening! 

     

     

     

    Hello @mvaneijgen, thank you for reply!

    Sorry for mistake, this is my fist approach to GSAP world.
    I follow your advise and i put in my code the "flex-basis" property.
    But i need that width it is 100% because, every "category slide" need content wich photo and text.
    The horizontal scroll must be tranlsate the first slide (slide with title "text with dynamic width for categories") -100% and the next 3 category slide must be stacked as you showed me.

    I have some sample from another site to show you, but i know this is not accepted in this forum.
     

  2. Hello everyone!

    I have some problem to use correctly Scrolltrigger.
    The problem it show when i try to translate all slide to "xPercent: -100" when scroll.
     

    var thirdPanel = document.querySelector(".third-panel");
        if (thirdPanel) {
          var thirdPanelRect = thirdPanel.getBoundingClientRect();
          const sectionsThirdPanel = gsap.utils.toArray(".third-panel .slide");
          if (sectionsThirdPanel.length > 0) {
            const numSections = sectionsThirdPanel.length - 1;
            const snapVal = 1 / numSections;
    
            gsap.to(sectionsThirdPanel, {
              xPercent: -100 * numSections,
              ease: "none",
              scrollTrigger: {
                trigger: ".third-panel .slide-second",
                pin: ".third-panel",
                scrub: true,
                snap: snapVal,
                start: `top+=${thirdPanelRect.top} top`,
                end: "+=" + document.querySelector(".third-panel").scrollWidth,
                markers: {
                  startColor: "red",
                  endColor: "red",
                  fontSize: "3rem",
                  indent: 200,
                },
              },
            });
          }
        }


    For clarity please check my codepen.

    My intention is to create a "stacking" slide alfter first blue slide.
    image.png.a2ed95d9711e79e9a4614b195190264b.png


    I hope I was clear, open the codepen for best result.
    For other information please ask.

    Mattia

    See the Pen RwYQzjJ by Dyakho (@Dyakho) on CodePen

×
×
  • Create New...