/    Sign up×
Community /Pin to ProfileBookmark

Reverse Animation when out o hover

I have this animation on hover https://codepen.io/raul-rogojan/pen/qBWQzVb?editors=0100
How can I make it run in reverse when out of hover?

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumSep 22.2019 — I made several attempts at your previous thread but no success when using pure CSS. Shurely it can be done easily by use of the Webanimation API. Then you can trigger and run the animation just as you like.

https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API
Copy linkTweet thisAlerts:
@codyhillauthorSep 22.2019 — @Sempervivum#1608967 I tried to do it with javascript but no success either.

https://codepen.io/raul-rogojan/pen/qBWQzVb?editors=0110
Copy linkTweet thisAlerts:
@SempervivumSep 23.2019 — In your codepen you didn't use the web animation API. Have a close look at my link.
Copy linkTweet thisAlerts:
@cootheadSep 23.2019 — Hi there RaulRogojan,

instead of _animation_ use _transition_ , which works in and **out**. ;)


``<i>
</i>&lt;!DOCTYPE HTML&gt;
&lt;html lang="en"&gt;
&lt;head&gt;

&lt;meta charset="utf-8"&gt;
&lt;meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"&gt;

&lt;title&gt;untitled document&lt;/title&gt;

&lt;!--&lt;link rel="stylesheet" href="screen.css" media="screen"&gt;--&gt;

&lt;style media="screen"&gt;
body {
background: #fbb03b;
font: normal 1em / 1.5em BlinkMacSystemFont, -apple-system, 'Segoe UI', roboto, helvetica, arial, sans-serif;
}

form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-top: 20p;
}
form input {
width: 280px;
font-size: 20px;
padding: 5px 10px;
border: none;
border-bottom: 2px solid #222;
background: transparent;
}
form label {
width: 280px;
color: #fff;
text-align:left;
}
form input::placeholder {
color: rgba(0, 0, 0, 0.3);
font-weight: 700;
}
form input:focus {
outline: none;
border-bottom: 3px solid #ff4800;
}
form button {
position: relative;
margin-top: 20px;
background: white;
color: #fbb03b;
font-size: 18px;
border: none;
border-radius: 50px;
font-weight: 500;
text-transform: uppercase;
width: 180px;
height: 45px;
outline: none;
transition: 200ms ease-in-out;
}
form button:hover,
form button:active {
color: #fff;
background: transparent;
}
form button:hover::after,
form button:active::after {
opacity: 1;
width: 180px;
height: 45px;
}

form button::after {
content: "";
position: absolute;
width: 220px;
height: 55px;
border: 2px solid #fff;
border-radius: 50px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0;
transition: 200ms ease-in-out;
}

&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;form&gt;
&lt;label for="em"&gt;Email:&lt;/label&gt;
&lt;input id="em" type="email" placeholder="Enter your email"&gt;
&lt;button type="submit"&gt;Submit&lt;/button&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;<i>
</i>
``



Also note that the _placeholder attribute_

**is not a replacement** for the _label attribute_.

**Further reading:-**

[url=https://duckduckgo.com/?q=placeholder+not+a+replacement+for+label&t=ffab&ia=web][color=#069]Placehoder is not a replacement for label[/color][/url]

_coothead_
Copy linkTweet thisAlerts:
@codyhillauthorSep 23.2019 — @coothead#1608983 Hi, thx! It works now
Copy linkTweet thisAlerts:
@cootheadSep 23.2019 — No problem, you're very welcome. ;)


[i]coothead[/i]
×

Success!

Help @codyhill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...