<div class="button" id="btn">
<span><i class="material-icons">send</i></span>
<span class="left">Send</span>
</div>
<div id="toast">
Sent!
</div>
body {
background: #273038;
display: flex;
overflow: hidden;
height: 100vh;
width: 100vw;
justify-content: center;
align-items: center;
font-family: 'Roboto', sans-serif;
font-weight: 300;
font-size: 1.2rem;
color: white;
}
.button {
border-radius: 3px;
transition: background .2s linear;
background: #00B288;
height: 60px;
width: 180px;
overflow: hidden;
position: relative;
display: flex;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
&:after {
position: absolute;
background: rgba(black, .2);
transform: scale(0);
height: 50px;
width: 50px;
margin-left: auto;
margin-right: auto;
margin-top: auto;
margin-bottom: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 2;
content: '';
border-radius: 50%;
}
&:hover {
cursor: pointer;
span {
transform: translateX(0);
}
}
&:not(:active) {
&:after {
animation: ripple .4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
background: darken(#00B288, 5%);
}
}
.left {
float: left;
}
span {
transform: translateX(-180px);
transition: transform .2s cubic-bezier(0.785, 0.135, 0.15, 0.86);
height: 60px;
flex-basis: 180px;
min-width: 180px;
display: inline-flex;
align-items: center;
justify-content: center;
}
#toast {
position: absolute;
bottom: 20px;
transform: translateY(15vh);
transition: transform .2s cubic-bezier(0.785, 0.135, 0.15, 0.86);
background: rgba(0, 0, 0, .4);
padding: 5px 10px;
border-radius: 5px;
}
@keyframes ripple {
0% {
transform: scale(0);
}
100% {
transform: scale(4);
}
}
View Compiled
let btn = document.getElementById('btn');
let toast = document.getElementById('toast');
btn.onclick = () => {
toast.style.transform = 'translateY(0)';
window.setTimeout(function(){
toast.style.transform = 'translateY(15vh)';
}, 2000);
}
This Pen doesn't use any external JavaScript resources.