Skip to content

Slide transition doesnt work in flexbox #13771

Answered by brunnerh
vhtmui asked this question in Q&A
Discussion options

You must be logged in to vote

You can create a custom transition that animates flex-grow. E.g.

function flexSlide(node) {
  return {
    duration: 250,
    easing: quadOut,
    css(t, u) {
      const grow = window.getComputedStyle(node).flexGrow;
      return `
          overflow: hidden;
          min-width: 0;
          flex: ${Math.round(t * 100 * grow) / 100} 1 0px;
      `;
    },
  };
}

REPL

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vhtmui
Comment options

Answer selected by vhtmui
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants