<div class="container">
<div class="login_bar">
<span class="login">super-email@gmail.com</span>
<span class="subscribe_button" onclick="subscribeOnClick()">subscribe</span>
<span class="subscribing"></span>
<span class="thanks"> Thank you. You have been subscribed</span>
</div>
</div>
@import url(https://fonts.googleapis.com/css?family=Lato:400,700);
body {
background:#11BCAF;
font-family: 'Lato', sans-serif;
font-weight: bold;
font-size: 14px;
color: #171D23;
margin: 00;
}
.container {
width: 300px;
height: 300px;
margin: auto;
}
.login_bar {
width: 300px;
height: 50px;
background: white;
border-radius: 10px;
top: 50%;
position: relative;
z-index: 1;
overflow: hidden;
}
.login {
background: transparent;
position: absolute;
height: 100%;
width: 190px;
padding-left: 10px;
text-align: left;
line-height: 50px;
vertical-align: middle;
z-index: 10;
transition: transform 0.2s ease-in-out 0s;
transition: transform 0.2s ease-in-out 0s;
transition: transform 0.2s ease-in-out 0s;
transition: transform 0.2s ease-in-out 0s;
}
.login_active {
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
}
.subscribe_button:hover{
background-color: #222A33;
cursor:pointer;
}
.subscribe_button {
background: #171D23;
position: absolute;
top: -50px;
left: 200px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
height: 150px;
width: 100px;
text-align: center;
line-height: 150px;
vertical-align: middle;
color: white;
transition: transform 0.5s ease 0s;
transition: transform 0.5s ease 0s;
transition: transform 0.5s ease 0s;
transition: transform 0.5s ease 0s;
}
.subscribe_button_active{
transform: translateY(50px);
transform: translateY(50px);
transform: translateY(50px);
transform: translateY(50px);
transform: translateY(50px);
}
.subscribing{
background: #CDD4DC;
height: 100%;
width: 300px;
z-index: 5;
position: absolute;
left:-300px;
display: inline-block;
transition: transform 1s ease 0s ;
transition: transform 1s ease 0s ;
transition: transform 1s ease 0s ;
transition: transform 1s ease 0s ;
}
.subscribing_active {
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
transform: translateX(300px);
}
.thanks{
background: transparent;
height: 100%;
width: 300px;
z-index: 5;
text-align: left;
line-height: 50px;
vertical-align: middle;
padding-left: 10px;
position: absolute;
top:50px;
display: inline-block;
transition: transform 0.5s ease 0s ;
transition: transform 0.5s ease 0s ;
transition: transform 0.5s ease 0s ;
transition: transform 0.5s ease 0s ;
}
.thanks_active {
transform: translateY(-50px);
transform: translateY(-50px);
transform: translateY(-50px);
transform: translateY(-50px);
transform: translateY(-50px);
}
var subscribe_button = document.querySelector(".subscribe_button");
subscribe_button.addEventListener('click', function(){
var subscribing = document.querySelector(".subscribing");
var thanks = document.querySelector(".thanks");
var login = document.querySelector(".login");
subscribing.classList.add("subscribing_active");
subscribe_button.classList.add("subscribe_button_active");
setTimeout(function(){
login.classList.add("login_active");
}, 1200);
setTimeout(function(){
thanks.classList.add("thanks_active");
}, 1400);
setTimeout(function(){
thanks.classList.remove("thanks_active");
login.classList.remove("login_active");
subscribing.classList.remove("subscribing_active");
subscribe_button.classList.remove("subscribe_button_active");
}, 4000);
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.