ScrollTrigger | Let your page react to scroll changes | Frontend Framework library

 by   terwanerik JavaScript Version: v1.0.6 License: MIT

kandi X-RAY | ScrollTrigger Summary

kandi X-RAY | ScrollTrigger Summary

ScrollTrigger is a JavaScript library typically used in User Interface, Frontend Framework, React applications. ScrollTrigger has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i scrolltrigger-classes' or download it from GitHub, npm.

Let your page react to scroll changes. The most basic usage of ScrollTrigger is to trigger classes based on the current scroll position. E.g. when an element enters the viewport, fade it in. You can add custom offsets per element, or set offsets on the viewport (e.g. always trigger after the element reaches 20% of the viewport). When using the callbacks ScrollTrigger becomes really powerfull. You can run custom code when an element enters / becomes visible, and even return Promises to halt the trigger if the callback fails. This makes lazy loading images very easy.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ScrollTrigger has a medium active ecosystem.
              It has 3797 star(s) with 319 fork(s). There are 65 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 2 open issues and 49 have been closed. On average issues are closed in 223 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ScrollTrigger is v1.0.6

            kandi-Quality Quality

              ScrollTrigger has 0 bugs and 0 code smells.

            kandi-Security Security

              ScrollTrigger has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              ScrollTrigger code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              ScrollTrigger is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              ScrollTrigger releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.
              ScrollTrigger saves you 117 person hours of effort in developing the same functionality from scratch.
              It has 295 lines of code, 0 functions and 15 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed ScrollTrigger and discovered the below as its top functions. This is intended to give you an instant insight into ScrollTrigger implemented functionality, and help decide if they suit your requirements.
            • Find a module .
            • Handle scroll position
            • Add trigger functions
            • Setup event handlers
            • Scroll animation loop
            • resize the canvas
            • Apply a counter to a counter
            • Create a trigger instance
            • A class for ScrollTrigger events .
            • draw the canvas
            Get all kandi verified functions for this library.

            ScrollTrigger Key Features

            No Key Features are available at this moment for ScrollTrigger.

            ScrollTrigger Examples and Code Snippets

            No Code Snippets are available at this moment for ScrollTrigger.

            Community Discussions

            QUESTION

            GSAP ScrollTrigger - Pin animation not working correctly
            Asked 2022-Mar-20 at 13:40

            I have an element called .listing__nav which I want to pin upon scroll.

            When the .listing__nav touches the top of the window, I want it to become fixed and to unpin only when the banner element comes into view.

            To achieve this, I've tried the following:

            ...

            ANSWER

            Answered 2022-Mar-20 at 13:40

            Resolved it with the below JS.

            I was creating two ScrollTriggers which was not required.

            Source https://stackoverflow.com/questions/71529008

            QUESTION

            Property 'querySelector' does not exist on type 'Document'
            Asked 2022-Mar-14 at 23:20

            i was following along some dude in youtube creating a landing page with animation using GSAP , but at the part when he uses scrollanimations he used gsap.to() method but the trick is when is use

            docement.querySelector('string here to class name')

            it gives me an error Property 'querySelector' does not exist on type 'Document'

            but it works perfectly with the man .. i did my research but can't find no thing useful here is the code

            ...

            ANSWER

            Answered 2022-Mar-14 at 23:16

            I don't know why this code exists:

            Source https://stackoverflow.com/questions/71475102

            QUESTION

            Animating child elements in ScrollTrigger GSAP horizontal scroll
            Asked 2022-Feb-10 at 06:32

            I have an svg which forms the basis of my horizontal scroller.

            Within this svg, I have added the class .animate to the elements which I want to fade in up as the item comes into view. The .animate class for reference has been added to all the text items in the svg.

            Currently, only the .animate elements that are in view initially fade in up. When I scroll down to continue the scroller, the other elements are static. They're not fading in or translating up or down in any way?

            TL;DR, here is what I'm trying to achieve:

            • When the scroller pins in place, and the user continued to scroll down, start fading away .horizontalScroller__intro.
            • Once .horizontalScroller__intro has faded away, start the horizontal scroll for .horizontalScroller__items
            • Any elements with the class of .animate in my scroller will fade in up to its original position.

            Note: I understand SO rules and preferences to post code here. But, my demo's contain a length SVG, which I cannot post here as it exceeds SO's character limit.

            Here is a demo of my latest approach

            From the scrollTrigger docs, containerAnimation is what helps achieve animations on horizontal scrollers, and is what I've tried to achieve.

            However, in my demo above, I have the following issues:

            1. .horizontalScroller__intro doesn't show initially, when it should, and should fade out on scroll.
            2. The horizontal scroller doesn't work anymore
            3. The .animate elements that are in view, do not fade in up

            If I use timeline (see below snippet), then the intro fade out and scroller works. But, doesn't animate in the child elements, which is where I need containerAnimation

            ...

            ANSWER

            Answered 2022-Feb-10 at 06:32

            You need to use onUpdate method on the scroll trigger.

            Source https://stackoverflow.com/questions/70928780

            QUESTION

            Failed to resolve module specifier "three" - Working Three/Wordpress Integration Suddenly Failed
            Asked 2022-Feb-09 at 19:48

            I manage a WordPress website which uses a Three.js animation on the homepage. I built this site months ago and everything had been working perfectly fine - I even showed it to someone a week ago and nothing was amiss. Yesterday, I check the site and find that Three is not loading, and that I have this in the console:

            Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".

            I don't have a line or even file to reference, the error is logged coming from the first line of the root domain. I want to emphasize that I had changed absolutely nothing about the set-up. I hadn't even updated to WP 5.9 yet. This is how I had originally set things up. Sorry if it's not best practices, but I want to emphasize that it did in fact work fine. Enqueuing animation javascript file and defining its type as "module":

            ...

            ANSWER

            Answered 2022-Feb-09 at 19:48

            I had exact same problem. I uploaded my project on Github a month ago (https://kramzin.github.io/threejs-task/) and since then didn't change a one symbol, but about a week ago it started showing same strange error in console. I found following: "Since r137 using ES6 modules like GLTFLoader in the browser requires an import map. Add the following section right below you canvas."

            Source https://stackoverflow.com/questions/70977276

            QUESTION

            GSAP and ScrollTrigger sections overlapping and executing before previous section has finished
            Asked 2022-Jan-29 at 08:07

            I have a problem that keeps popping up with GSAP and ScrollTrigger.

            I have multiple pinned sections where, as the user scrolls into a section, images slide in from the side.

            When I make these images slide in from the same side everything is fine, but as soon as I make a section slide in from the right the sections start to overlap as though it is executing before the previous pin has finished.

            Strangely, if the top section slides in from the right then the next section is fine, but any further down the page cause issues.

            I have a Codepen here: https://codepen.io/rob-wahlberg-beaney/pen/BamNxaN?editors=1010

            Here's the code to slide things left:

            ...

            ANSWER

            Answered 2022-Jan-29 at 08:07

            Your pinning sections are all in the same HTML level and have no parent to actually pin them on. And you initialize them not sequentially which makes the HTML structure messed up.

            If your sections are in this order left-right-left-right, you should run the ScrollTrigger in the same order. As of now, your script is running like left-left-right-right which is not good.

            The solution for your case is to initialize the ScrollTrigger sequentially from top to bottom, we can do that by merging your scripts into one like this.

            Source https://stackoverflow.com/questions/70893045

            QUESTION

            Parallax effect within pinned GSAP container
            Asked 2022-Jan-23 at 23:42

            I have a block which becomes pinned and scrolls horizontally.

            Within this block, I have a vector which has a width of 3573px.

            When a user scrolls horizontally, I want the vector to scroll also, alongside the images in my demo.

            Have tried moving my vector under .horizontalScroller__scroll, so that it scrolls alongside the images, but that didn't work.

            See demo:

            ...

            ANSWER

            Answered 2022-Jan-23 at 23:42

            QUESTION

            GSAP ScrollTrigger animations not working with Locomotive JS (until window is resized)
            Asked 2022-Jan-23 at 15:37

            I have sections across my site which are using ScrollTrigger. Once I implemented Locomotive JS, all of my ScrollTrigger animations stopped working.

            I read through the forums and saw that you need to update() ScrollTrigger when Locomotive is scrolling. I implemented this and saw no results.

            Then, I resized the window and my ScrollTrigger animations that were in view, they started working.

            In short, animations trigger on resize, but not on page load.

            I've implemented update() and also tried refresh(), but no luck.

            Demo (fiddle showing issue here also):

            ...

            ANSWER

            Answered 2022-Jan-23 at 15:37

            These are what I've tried to get the animation run.

            1. Let ScrollTrigger know about the new scroller.

            As you're using Locomotive scroll that means the native scroll which ScrollTrigger is based on is removed. So we bring it back by doing this:

            Source https://stackoverflow.com/questions/70748627

            QUESTION

            Run ScrollTrigger animation once (once: true not working)
            Asked 2022-Jan-19 at 00:58

            I have an ScrollTrigger animation which I only want running once.

            As per the docs, "If true, the ScrollTrigger will kill() itself as soon as the end position is reached once."

            However, in my case, when I add once: true, I get the message "Invalid property", "once", "set to", true, "Missing plugin? gsap.registerPlugin()" in console, when I've registered the plugin already?

            ...

            ANSWER

            Answered 2022-Jan-19 at 00:58

            QUESTION

            GSAP stagger animation
            Asked 2022-Jan-18 at 15:08

            If an element has the class .stagger then I'm trying to execute an animation which shows the cards one by one.

            In my current demo, the cards all fade in together. Even though I've specified a delay?

            How can I the cards to appear one by one?

            ...

            ANSWER

            Answered 2022-Jan-18 at 15:08

            In my current demo, the cards all fade in together. Even though I've specified a delay?

            Each card has a 0.5s delay, so the'll move all together.

            Use a delay based on the current card index:

            Source https://stackoverflow.com/questions/70757850

            QUESTION

            Gsap ScrollTrigger with fullpage.js
            Asked 2022-Jan-14 at 12:10

            I have a problem using GSAP ScrollTrigger inside React fullpage.js . I have several sections with the "section" class. Inside them there is content that is not thought of as immediately visible. I need that when loading my site and initializing fullpage.js I had the opportunity to scroll through my section and run GSAP timeline together with ScrollTrigger. I don't understand why scrollTrigger doesn't work inside a section with scrollOverflow = {true}. In my idea, it looks like this: the site loads, React fullpage initialization, then the section with animation scrolls (as in the codepen I attached). After gsap.timeline ends, fullpage.js sections are switched . How to implement this? I ask for help. Link to codepen: https://codepen.io/desginer123/pen/WNZLpQj Link to the current website with React fullpage.js: https://projectxmain48161.gtsb.io/ React fullpage settings.js:

            ...

            ANSWER

            Answered 2022-Jan-14 at 12:10

            I don't understand why scrollTrigger doesn't work inside a section with scrollOverflow = {true}.

            Because sections using scrollOverflow are not using the browser scroll behaviour but a JavaScript simulated one.

            fullPage.js version 4 will work differently in this regard and you'll probably have it easier in there to do what you need. It should come out by the end of this month.

            Source https://stackoverflow.com/questions/70705058

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ScrollTrigger

            npm install @terwanerik/scrolltrigger or just add the dist/ScrollTrigger.min.js file to your project and import that.

            Support

            Fork, have a look in the src/ directory and enjoy! If you have improvements, start a new branch & create a pull request when you're all done :).
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/terwanerik/ScrollTrigger.git

          • CLI

            gh repo clone terwanerik/ScrollTrigger

          • sshUrl

            git@github.com:terwanerik/ScrollTrigger.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link