Flat Download Button

HTML
<div class='btn'>Download</div>
CSS
* { box-sizing: border-box; margin: 0; padding: 0; } html, body { height: 100vh; width: 100vw; background: #222d38; display: flex; justify-content: center; align-items: center; font-family: 'Oswald', sans-serif; } .btn { background: #e74c3c; width: 200px; position: relative; padding: 15px; color: #F4F4F4; cursor: pointer; text-align: center; text-transform: uppercase; letter-spacing: 4px; transition: all 500ms cubic-bezier(0.6, -0.28, 0.735, 0.045); } .btn-progress { width: 500px; color: transparent; } .btn-fill:after { content: ''; position: absolute; top: 0; left: 0; background: #c0392b; height: 100%; animation: fill 3.2s linear forwards; } .btn-complete { padding: 10px; width: 42px; color: transparent; pointer-events: none; } .btn-complete:after { font-family: FontAwesome; content: "\f00c"; color: #F4F4F4; margin: -18px 3px; position: absolute; display: block; } @keyframes fill { from { width: 0; } to { width: 100%; } }
JAVASCRIPT
$(function() { var btn = $(".btn"); btn.on("click", function() { $(this).addClass('btn-progress'); setTimeout(function() { btn.addClass('btn-fill') }, 500); setTimeout(function() { btn.removeClass('btn-fill') }, 4100); setTimeout(function() { btn.addClass('btn-complete') }, 4400); }); })
Expand for more options Login