How do I have the properties of a declaration apply to an element after the CSS3 transitions end? I have something like:
.something { background: blue; padding: 10px 0px; background-clip: content-box; transition: box-shadow 300ms; } .something:hover { box-shadow: 0px 0px 3px blue; padding: 0px; margin: 10px 0px; }
I'd like the padding and margin properties in the :hover declaration to be applied after the transition is done in 300ms.
The transition-property property specifies the name of the CSS property the transition effect is for (the transition effect will start when the specified CSS property changes). Tip: A transition effect could typically occur when a user hover over an element.
To trigger an element's transition, toggle a class name on that element that triggers it. To pause an element's transition, use getComputedStyle and getPropertyValue at the point in the transition you want to pause it. Then set those CSS properties of that element equal to those values you just got.
The transition effect will start when the specified CSS property (width) changes value.
Abstract. CSS Transitions allows property changes in CSS values to occur smoothly over a specified duration.
you can add a delay like this:
transition: box-shadow 300ms; transition: padding 300ms 400ms;
the first will start on hover and last 300ms, the second will start after 400ms and again last 300ms.
DEMO
Article on CSS-Tricks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With