Jump to content
Search Community

ScrollTrigger starts from a wrong position

Keyur kadam test
Moderator Tag

Recommended Posts

@Keyur kadam as I stated that doesn't work for me, it just selects the text. Next to that we can't debug live sites, there is no way for us to disable CSS or Javascript, so that is something only you can do.

 

If it isn't happing in codepen it is clearly some third party script that is interfering, so as I set disable everything one by one until the markers are correct and try debugging from there. 

  • Like 1
Link to comment
Share on other sites

Hi @Keyur kadam,

 

Sorry to hear about the issues you are having. Unfortunately the codepen example shows that GSAP is working and doing exactly what is supposed to do. On top of that debug a live complex site (which looks really good by the way, great job!! 🎉) is quite hard.

 

The only advice I can offer is to create the ScrollTrigger instance of that particular section after everything else has been loaded. Is quite odd that every other ScrollTrigger animation is working as expected except for that, so clearly something is causing that section to have an offset in the start and end trigger positions. Perhaps create an example of the site just with that section or run a refresh method on that particular ScrollTrigger instance on the event handler for the Enter Presentation click event. Most likely there is something causing a layout shift that affects just that section.

 

As @mvaneijgen already suggested you'll have to isolate this going part by part or create a new instance of the site using the header footer and that section and then start adding the rest of the sections until it breaks.

 

Sorry we can't help you any further than this. Let us know if you have any other question.

 

Happy Tweening!

Link to comment
Share on other sites

@mvaneijgen @Rodrigo i have found the issue i have scrolltrigger js for above div also. it causing the problem. because of the width. can you please tell me the solution for this? https://drive.google.com/file/d/11x1lvsLuCi4kDywRqExW499X3Bz25uch/view

 

javascript:

// this script for above div

let tl = gsap.timeline({
  scrollTrigger:{
      trigger: $("#animated-image-text"),
      // pin: ".keyur-animation",
      start: "center bottom",
      end: "+=200 ",
      scrub: true,
      // pin: true
      // markers: true
      // scrub: true
  }
});
tl.from($("#animated-image-text"),{width:800, opacity:1, duration:1});
 
// The script for the div with an incorrect start position
const initialPositions = [
    { x: -576, y: 0 },
    { x: -192, y: -384 },
    { x: 480, y: -96 },
    { x: -288, y: 576 },
    { x: 576, y: 288 },
    { x: 0, y: 0 },
    { x: 75, y: 0 },
    { x: -75, y: 75 },
    { x: 0, y: 75 },
    { x: 75, y: 75 }
  ];
  gsap
    .timeline({
      scrollTrigger: {
        trigger: ".grid-container",
        start: "top top",
        end: () => "+=500",
        scrub: 1.5,
        pin: true,
        anticipatePin: 0,
        pinSpacing: true,
        markers: {
            startColor: "purple",
            endColor: "fuchsia",
            fontSize: "3rem",
        }
      },
      delay: 0.2
    })
    .set(".gridBlock", { autoAlpha: 0 })
    .to(".gridBlock", { duration: 0.1, autoAlpha: 1 }, 0.01)
    .to(".grid-container .title-text", { opacity: 0, duration: 1 }, 0.01)
    .from(
      ".gridLayer",
      {
        x: (index) => initialPositions[index].x,
        y: (index) => initialPositions[index].y,
        ease: "none"
      },
      "<"
    )
    .to({}, {}, "+=0.2");
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...