Answer the question
In order to leave comments, you need to log in
Why does the animation twitch or not fire with a given transition?
I'd like to implement a two-pane page and have one of the panels slide smoothly off the edge of the screen.
I am using Bootstrap 5 and have divided the page into 2 col. A "pop-up" col has a width set by the "col-auto" class. I didn't come up with anything better than to "push" it by setting the class "col-1" and writing for this class "width: 0px;"
As it turned out now - the panel first sharply changes its width almost to the end, then the animation is triggered on a very small section of the width.
https://jsfiddle.net/1w79srct/
-
If css is replaced with:
#idDiv1 {
transition: all 500ms;
}
.col-1 {
width: 0px;
}
<div id="idDiv1" class="col-auto bg-warning p-0">
#idDiv1 {
transition: all 500ms;
}
.col-1 {
padding: 0px;
width: 0px;
}
.col-auto {
width: 300px;
}
Answer the question
In order to leave comments, you need to log in
Initially, no one knows the size of your block, based on this, the animation twitches. For example, you can set the width as a percentage, which is quite logical, because the table of contents cannot be larger than the body text. Also, you can add code that will calculate the width of the area upon loading and then set it for the block, which will allow the animation to be performed correctly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question