0
I have a CSS code that makes an animation of a modal go down and stand in the middle of the screen, now I needed to reverse this animation, I need the modal that is in the middle of the screen go up and disappear.
What information should I change to do the reverse?
It is not necessary to delete the current codes, I intend to take advantage of them in another part of the application, I would need new classes that do the opposite of the current.
Follows the code:
a {
color: #92badd;
display:inline-block;
text-decoration: none;
font-weight: 400;
}
.wrapper {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 100%;
min-height: 100%;
padding: 20px;
}
#formContent {
-webkit-border-radius: 10px 10px 10px 10px;
border-radius: 10px 10px 10px 10px;
background: #fff;
padding: 30px;
width: 90%;
max-width: 400px;
position: relative;
padding: 0px;
-webkit-box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
box-shadow: 0 30px 60px 0 rgba(0,0,0,0.3);
text-align: center;
}
#formContent img {
width: 150px;
height: 80px;
margin-top: 20px;
margin-bottom: 20px;
}
input[type=button], input[type=submit], input[type=reset] {
background-color: #56baed;
border: none;
color: white;
height: 40px;
text-align: center;
text-decoration: none;
display: inline-block;
text-transform: uppercase;
width: 85%;
font-size: 13px;
-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
margin: 5px 20px 40px 20px;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
cursor: pointer;
}
input[type=button]:hover, input[type=submit]:hover, input[type=reset]:hover {
background-color: rgb(27, 150, 216);
}
input[type=text], input[type=password] {
background-color: #f6f6f6;
color: #0d0d0d;
height: 50px;
border: 0px;
text-align: center;
font-size: 16px;
margin: 5px;
width: 85%;
background-color: rgb(245, 245, 245);
border: 1px solid white;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
input[type=text]:focus, input[type=password]:focus {
background-color: white;
border: 1px solid #5fbae9;
}
.fadeInDown {
-webkit-animation-name: fadeInDown;
animation-name: fadeInDown;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
@-webkit-keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
@keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translate3d(0, -100%, 0);
transform: translate3d(0, -100%, 0);
}
100% {
opacity: 1;
-webkit-transform: none;
transform: none;
}
}
/* Simple CSS3 Fade-in Animation */
@-webkit-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@-moz-keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
.fadeIn {
opacity:0;
-webkit-animation:fadeIn ease-in 1;
-moz-animation:fadeIn ease-in 1;
animation:fadeIn ease-in 1;
-webkit-animation-fill-mode:forwards;
-moz-animation-fill-mode:forwards;
animation-fill-mode:forwards;
-webkit-animation-duration:1s;
-moz-animation-duration:1s;
animation-duration:1s;
}
.fadeIn.first {
-webkit-animation-delay: 0.25s;
-moz-animation-delay: 0.25s;
animation-delay: 0.25s;
}
.fadeIn.second {
-webkit-animation-delay: 0.5s;
-moz-animation-delay: 0.5s;
animation-delay: 0.5s;
}
<body>
<div id="teste" class="wrapper fadeInDown">
<div id="formContent">
<div class="fadeIn first">
<img src="img/logo.png">
</div>
<div>
<input type="text" class="fadeIn second" name="iptUserLogin" placeholder="Usuário" required>
<input type="text" class="fadeIn second" name="iptSenhaLogin" placeholder="Senha" required>
<input type="button" class="fadeIn second" name="btnLogin" value="Entrar">
</div>
</div>
</div>
</body>
huahuahua, no time to enter the data
– user60252
@Leocaracciolo "In this example we will simply point to the id
formContent
since it is at hand, for demonstration purposes".– Chun
@Leocaracciolo "trigger it when there is a click on a specific element like the Login button for example"
– Chun
We go right away to run to see if it’s okay and notice something that doesn’t work well and then nor read the answer
– user60252
@Cʜᴜɴ It worked perfectly, I just added the
.fadeAlternate
and worked right. Thank you very much– D. Watson
@Cʜᴜɴ I would just like to ask a question, I saw that you removed
-webkit-animation-delay
and the-moz-animation-delay
, was for explanatory purposes only or these attributes make no difference?– D. Watson
@J.Thatcher A bit of both. Some of these styles can be compressed in just one row as in the class example
fadeAlternate
where I added all the properties in one line. However I think most browsers nowadays recognize only the propertyanimation
without necessarily having to designate the prefix for each of them,-webkit-
,-moz-
etc.. Caniuse Animation. You can also see a list of properties you can compress by inspecting a animated element– Chun