CSS Processing Button
How do I make an css processing button?
Nothing special, just a css button with a processing, success and error state. What is a css processing button? How do you make a css processing button? This script and codes were developed by Stephen Fray on 20 January 2023, Friday.
CSS Processing Button - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Processing Button</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <a class="btn p" href="#">Submit</a>
<div class="f success">Fake Success State</div>
<div class="f error">Fake Error State</div>
<div class="f reset">Reset</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
CSS Processing Button - Script Codes CSS Codes
body { font-family: arial;
}
.f { margin: 20px 0 0; cursor: pointer; background-color: #ccc; padding: 10px 20px; display: inline-block; clear: both; transition: all 0.2s ease-in; float: left;
}
.f:hover { background-color: #333; color: #fff;
}
.f:first-of-type { margin: 50px 0 0;
}
.btn { background-color: #17b678; transition: all 0.2s ease-in; display: inline-block; padding: 10px 25px; color: #fff; text-decoration: none; position: relative; float: left;
}
.btn:hover { background-color: #089475;
}
.btn.loading { background-color: #089475; padding: 10px 70px 10px 25px;
}
.btn.loading::after { visibility: visible; opacity: 1; width: 20px; height: 20px; transition: all 0.2s ease-in; transition-delay: 0.3s;
}
.btn::after { visibility: hidden; opacity: 0; content: ""; position: absolute; top: calc(50% - 12px); right: 10px; border-left: 2px solid white; border-top: 2px solid transparent; border-right: 2px solid white; border-bottom: 2px solid transparent; border-radius: 50px; animation: rotate 1s infinite; animation-timing-function: linear;
}
.btn.e { background-color: red; animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; transform: translate3d(0, 0, 0); animation-delay: 0.4s; backface-visibility: hidden;
}
.btn.s { background-color: #089475; padding: 10px 45px 10px 25px;
}
.btn.s::before { content: ""; position: absolute; width: 6px; height: 12px; animation: success 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; transform: rotate(45deg); animation-delay: 0.3s; backface-visibility: hidden; right: 15px; border-right: 3px solid #fff; border-bottom: 3px solid #fff;
}
@keyframes rotate { 100% { transform: rotate(360deg); }
}
@keyframes success { from { opacity: 0; } to { opacity: 1; }
}
@keyframes shake { 10%, 90% { transform: translate3d(-1px, 0, 0); } 20%, 80% { transform: translate3d(2px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-4px, 0, 0); } 40%, 60% { transform: translate3d(4px, 0, 0); }
}
CSS Processing Button - Script Codes JS Codes
// Test Functions -- these are just test functions that have been thrown togther
$(function(){ var $btn_text = $(".btn.p").text(); // Loading class, use on ajax etc $(".btn.p").click(function(){ var $this = $(this); $(".btn.p").text("Submitting..."); $this.addClass("loading"); }) // Add Success state, for ajax -- Needs to remove itself so form etc can be resubmitted $(".success").click(function(){ var $this = $(this); $(".btn.loading").text("Updated!"); $(".btn.loading").removeClass("loading").addClass("s"); setTimeout(reset, 2500); }) // Add Error state, for ajax error fallover $(".error").click(function(){ var $this = $(this); $(".btn.loading").text("Error!"); $(".btn.loading").removeClass("loading").addClass("e"); setTimeout(reset, 2500); }) // Reset Button $(".reset").click(function(){ reset(); }) function reset(){ $(".loading").removeClass("loading"); $(".e").removeClass("e"); $(".s").removeClass("s"); $(".btn.p").text($btn_text); }
});
Developer | Stephen Fray |
Username | stepfray |
Uploaded | January 20, 2023 |
Rating | 3 |
Size | 3,605 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Form Submit - Tick Confirmation | 3,007 Kb |
Simple Stripped Element Background for Text | 1,534 Kb |
Pure CSS Slanted Shadows | 1,901 Kb |
Fixed width, fluid Background with one element | 1,897 Kb |
Super Simple Modal | 3,182 Kb |
Hc first draft | 5,104 Kb |
A Pen by stephen fray | 5,080 Kb |
Sticky Box with Poly Fill | 2,625 Kb |
Full screen slider mk2 | 3,265 Kb |
Message Sent Test | 4,826 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Prototype Responsive Homepage | Heyitsolivia | 7,677 Kb |
E-mail Template | SoloMDFK | 4,871 Kb |
Navier Stoke Fluid Simulation | Esimov | 8,584 Kb |
Text Looping Transition | Agelber | 5,619 Kb |
Personal Website Redesign v2.0 | DevItWithDavid | 5,168 Kb |
Click Based Rotation Demo | Zeaklous | 2,086 Kb |
A Pen by Bryan | Brydave | 2,286 Kb |
Scifi-style Interative Form | Aaronchuo | 4,566 Kb |
A Pen by Adrien Clerbois | AClerbois | 6,501 Kb |
My Starter Kit For Codepen | Dkdesign | 2,012 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!