V
V
valgerofficial2021-06-06 02:55:01
css
valgerofficial, 2021-06-06 02:55:01

Why does transition only work in one direction?

When scrolling down, the transition does not work, but when scrolling to the top it works. Where is the mistake?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kryamk, 2021-06-06
@kryamk

Well, apparently it doesn't animate from height: 100% to height: auto;
But if you change auto to 0%, then more or less, but I'm not sure that this will work

#main.active {
  min-height: auto;
  height: 0%;
}

A
Alexander Leleka, 2021-06-06
@Laweb

Maybe a ready-made script will suit you?
https://youtu.be/RX5kFtUI7q0

S
strelok011, 2021-06-07
@strelok011

You write a small js to get the height of your page (well, or the element on which the effect should appear) after loading, add the initialization of the same code to resize (you never know how the content behaves), use this value for animation.
If the height is not known, no transitions and animations will work correctly. Any accordions, scrolls, etc. require a known height to work correctly. Her browser, unfortunately, "on the machine" does not slip.
I do not give a solution, you can find it on the Internet. But he described the general meaning of the actions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question