Animating a background moving between grid elements
I made this simple switch but I wanna animate the background moving from left to right instead of having it disappear and reappear.
Right now the background is just a css class applied when the item is active, but I was thinking of creating a grid item that overlaps the other two with the same width to achieve this. Couldn't get it working though, any tips on how I can do this?
This is my current component
6 Replies
Basically something like this but for the background
I don't know that you need to use grid for this (the example below doesn't use grid).
hopefully that's helpful 😄
that's fixed width unfortunately but thank you
yep, it's fixed width right now, but can you think of any way to make this work for dynamic width buttons?
have seen made something simillar using framer motion
https://manuarora.in/demos/demo/navbarEffect
https://manuarora.in/snippets/navbar-effect
Manu Arora
Navbar Hover - Code Snippet
A collection of code snippets – including serverless functions, Node.js scripts, and CSS tricks.