Replies: 6 comments 11 replies
|
Facing the same issue here, would be a nice feature to have. |
|
any solution brother? |
|
I know I'm super late with this, but you can extend tailwind by adding a utility class. These automatically get the variants: https://tailwindcss.com/docs/adding-custom-styles#using-css-and-layer. This needs to be added in the CSS file you're declaring tailwind in: I've included the Tailwind declaration just so it's clear which file you'll need to put this in. Also this is for Tailwind 3. Now you can simply use the class: hover:pause |
|
For anyone coming here for a solution that works on Tailwind v4, here's what I ended up with: @utility pause-animation {
animation-play-state: paused;
}which lets you use it like it's a native utility, e.g.: |
|
It would be great addition , utility is also missing for @utility animate-infinite {
animation-iteration-count: infinite;
}
@utility animate-once {
animation-iteration-count: 1;
}
@utility animate-twice {
animation-iteration-count: 2;
}
@utility animate-thrice {
animation-iteration-count: 3;
}
@utility animate-iteration-* {
animation-iteration-count: --value(integer, [integer]);
}
/* play state */
@utility animate-run {
animation-play-state: running;
}
@utility animate-play {
animation-play-state: running;
}
@utility animate-pause {
animation-play-state: paused;
} |
|
Just as an update for anyone still checking for this - Tailwind V4 now includes the classnames "paused" & "running". Simply add the classname as with other Tailwind classnames as follows: |
Uh oh!
There was an error while loading. Please reload this page.
I just noticed that there's no
animation-play-state: pausedin vanilla tailwind.It will be nice if we can use
hover:animate-pausedor something like that.All reactions