JSFiddle - React, Tailwind, and code Playground
by Moor
HTML
<div id="footer-subscribe-block-inner" class="clearfix">
<div id="subscribe-email-bg">
<input id="subscribe-email" type="email" placeholder="[email protected]" />
</div>
<button type="submit" id="subscribe-submit" onClick="javascript:omgemailgone();">></button>
</div>
CSS
#footer-subscribe-block-inner {
background-color:#FE975F;
color:#FFF;
font-size:90%;
padding:24px;
min-height:102px;
}
#footer-subscribe-block-inner #subscribe-email-bg {
float:left;
height:30px;
width:138px;
position:relative;
background:#FFF;
}
#footer-subscribe-block-inner #subscribe-email-bg.gone {
background:#F7C0A3;
}
#footer-subscribe-block-inner #subscribe-email {
position:absolute;
top:0;
height:30px;
width:130px;
font-family:'PT Sans Narrow', mono;
font-size:14px;
color:#222;
border:none;
line-height:20px;
padding:0 4px;
}
#footer-subscribe-block-inner #subscribe-email.gone {
top:-120px;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
-webkit-transform:matrix(2, 0, 0, 0, 0, 0);
-moz-transform:matrix(2, 0, 0, 0, 0, 0);
-o-transform:matrix(2, 0, 0, 0, 0, 0);
-ms-transform:matrix(2, 0, 0, 0, 0, 0);
transform:matrix(2, 0, 0, 0, 0, 0);
filter: progid:DXImageTransform.Microsoft.Matrix(M11=2, M12=0, M21=0, M22=0, Dx=0, Dy=0);
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
-ms-transition: all 0.5s;
transition: all 0.5s;
}
#footer-subscribe-block-inner #subscribe-email::-webkit-input-placeholder {
font-style:italic;
color:#777;
}
#footer-subscribe-block-inner #subscribe-email:-moz-placeholder {
font-style:italic;
color:#777;
}
#footer-subscribe-block-inner #subscribe-submit {
height:30px;
background:url(/assets/img/arrow-right.png) center center no-repeat #9D62A5;
float:left;
width:30px;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-ms-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
border:none;
}
#footer-subscribe-block-inner #subscribe-submit:hover {
background-color:#7F3D88;
}
JavaScript
function omgemailgone() {
if (!document.getElementById("subscribe-email").checkValidity()) {
document.getElementById("subscribe-email").setAttribute("class", "gone");
document.getElementById("subscribe-email-bg").setAttribute("class", "gone");
alert("input not valid!");
}
}