Giter VIP home page Giter VIP logo

Comments (4)

yangxiuxiu1115 avatar yangxiuxiu1115 commented on May 18, 2024

workground

from core.

teddygunawan avatar teddygunawan commented on May 18, 2024

Hello!

It seems to be the expected behavior of your codes, this part of the code
.list-leave-active { position: absolute; }

Causes the element to be positioned absolutely during transition, which means the element won't follow the usual flow of the document anymore. In this case, because u didn't specify its ancestor, it will have different behavior when it is scrolled vs when it isn't as it will be absolutely positioned against the viewport, you see this by manually adding absolute position to each test element. Here is ChatGpt explanation of it.

You can fix this either by

  1. Removing absolute positioning (.list-leave-active) in the transition. However this will cause the top and bottom element to snap at the end of transition instead of smoothly moving to position.
  2. By adding position: relative to .list-box1 class, however, it is still not a perfect solution as it will cause the .test element to move downward a little bit due to the fact that the scrolling container resizes. This container resizing is why upper element is not affected but bottom element is affected by this. If you don't like this, the only way left is to change the transition animation.

Hope this helps!

from core.

bambooGHT avatar bambooGHT commented on May 18, 2024

Hello!

It seems to be the expected behavior of your codes, this part of the code .list-leave-active { position: absolute; }

Causes the element to be positioned absolutely during transition, which means the element won't follow the usual flow of the document anymore. In this case, because u didn't specify its ancestor, it will have different behavior when it is scrolled vs when it isn't as it will be absolutely positioned against the viewport, you see this by manually adding absolute position to each test element. Here is ChatGpt explanation of it.

You can fix this either by

  1. Removing absolute positioning (.list-leave-active) in the transition. However this will cause the top and bottom element to snap at the end of transition instead of smoothly moving to position.
  2. By adding position: relative to .list-box1 class, however, it is still not a perfect solution as it will cause the .test element to move downward a little bit due to the fact that the scrolling container resizes. This container resizing is why upper element is not affected but bottom element is affected by this. If you don't like this, the only way left is to change the transition animation.

Hope this helps!

Thank you!
I really hope there is a perfect solution, but it seems impossible to achieve it at the moment, so I can only give up.

from core.

yyx990803 avatar yyx990803 commented on May 18, 2024

You need to make your items position relative to the container, i.e. add position: relative to .list-box1: demo

from core.

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.