Giter VIP home page Giter VIP logo

Comments (5)

mciastek avatar mciastek commented on July 28, 2024 2

I did a test and it looks like there is a problem with translation itself. Basically, when element is shifted by 20% of it's size, threshold (with value 0.5) doesn't match the center point of the element. Solution here is to either animate only when the animation has ended or apply new threshold for shifted elements. I will think about a fix for this problem.

from sal.

mciastek avatar mciastek commented on July 28, 2024 1

Thanks for catching this bug! It looks like wrong threshold setting and I need to confirm it. I'll be back with patch as soon as possible.

from sal.

Geestig avatar Geestig commented on July 28, 2024

After trying out some fixes it seems you have to offset the threshold by 20% to make up for the translateY, not 100% working yet though.

from sal.

Geestig avatar Geestig commented on July 28, 2024

@mciastek any updates on how to solve this?

from sal.

mciastek avatar mciastek commented on July 28, 2024

I checked this bug and I need to find a way how to resolve it without adding too much complexity to sal.js. To fix this I would need to let sal know how certain element was translated and update the threshold accordingly.

Here's a workaround for this problem. As Intersection Observer detects if specific amount of pixels are present in viewport, every time you translate the element, it's pixels are also translated. So to bypass this behaviour you need to wrap this element in a wrapper, which will be detected by sal. Next you need to disable animations on the wrapper. Then you can apply animation to proper element. Here's a simple demo - https://codesandbox.io/s/nkolnk00n0.

I will try to come up with solution, but I'm open to any ideas.

from sal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.