Activate Button
How do I make an activate button?
What is a activate button? How do you make a activate button? This script and codes were developed by Alexandre Masy on 01 October 2022, Saturday.
Activate Button - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Activate Button</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<main class="main"> <section class="demo"><a class="btn -normal" href="#" data-label-normal="activate" data-label-loading="waiting" data-label-activated="activated"> <div class="btn__first"> <div class="btn__circle"><span class="btn__icon"></span></div> </div> <div class="btn__second"><span class="btn__label">Activate</span></div></a></section>
</main> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Activate Button - Script Codes CSS Codes
* { box-sizing: border-box;
}
.demo { position: absolute; left: 50%; top: 30%;
}
.btn { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; padding: 13px 16px; border-radius: 100px; background-color: #309eeb; color: #ffffff; text-decoration: none; -webkit-transform-origin: center; transform-origin: center;
}
.btn__first { margin: 0px 8px 0px 0px; width: 18px; height: 18px;
}
.btn__circle { position: relative; width: 18px; height: 18px; border-radius: 100%;
}
.btn__label { position: relative; font-weight: 300; letter-spacing: .4px; overflow: hidden;
}
.btn__label::after { display: none; content: 'Waiting'; position: absolute; top: -20px; left: 0px;
}
.btn.-normal .btn__circle { border: 9px solid #ffffff;
}
.btn.-normal:hover { background-color: #2b8ed3;
}
.btn.-normal:hover .btn__icon { -webkit-animation: normal-icon .3s; animation: normal-icon .3s;
}
.btn.-normal:active { -webkit-transform: scale(0.99); transform: scale(0.99);
}
@-webkit-keyframes normal-icon { 0% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } 40% { -webkit-transform: translateY(100%) rotate(-45deg); transform: translateY(100%) rotate(-45deg); } 100% { -webkit-transform: translateY(0%) rotate(-45deg); transform: translateY(0%) rotate(-45deg); }
}
@keyframes normal-icon { 0% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } 40% { -webkit-transform: translateY(100%) rotate(-45deg); transform: translateY(100%) rotate(-45deg); } 100% { -webkit-transform: translateY(0%) rotate(-45deg); transform: translateY(0%) rotate(-45deg); }
}
.btn.-waiting .btn__circle { -webkit-animation: waiting-circle .7s; animation: waiting-circle .7s; border: 2px solid #ffffff;
}
@-webkit-keyframes waiting-circle { 0% { border: 9px solid #ffffff; } 100% { border: 2px solid #ffffff; }
}
@keyframes waiting-circle { 0% { border: 9px solid #ffffff; } 100% { border: 2px solid #ffffff; }
}
.arrow-up, .btn.-normal .btn__icon { color: #309eeb; position: absolute; top: -4px; left: -1px; width: 2px; height: 8px; background-color: currentColor;
}
.arrow-up:before, .btn.-normal .btn__icon:before { content: ''; position: absolute; left: -2px; top: 0px; width: 4px; height: 4px; border-top: solid 2px currentColor; border-right: solid 2px currentColor; -webkit-transform: rotate(-45deg); transform: rotate(-45deg);
}
.check, .btn.-normal:hover .btn__icon { color: #2b8ed3; position: absolute; top: -3px; left: -4px; width: 8px; height: 5px; border-bottom: solid 2px currentColor; border-left: solid 2px currentColor; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); background-color: transparent;
}
.check:before, .btn.-normal:hover .btn__icon:before { display: none;
}
Activate Button - Script Codes JS Codes
(function(window)
{ /** * Btn constructor **/ function btn( view ) { this.view = jQuery(view); this.init(); } btn.NORMAL = {"class":"-normal"}; btn.WAITING = {"class":"-waiting"}; btn.ACTIVATED = {"class":"-activated"}; /** * Prototype **/ var p = btn.prototype; /** * Init the button **/ p.init = function() { this._state = null; this.view.on('mousedown', onItemDown.bind(this)); this.setState(btn.NORMAL); } /** * Define the state of the view * * @param value String **/ p.setState = function( value ) { if (value != btn.NORMAL && value != btn.WAITING && value != btn.ACTIVATED ) throw new Error('Not a valid state'); var klasses = [btn.NORMAL.class, btn.WAITING.class, btn.ACTIVATED.class].join(' '); this._state = value; this.view.removeClass( klasses ).addClass( this._state.class ); } /** * Btn mouse down handler * * @param event MouseEvent */ function onItemDown(event) { event.preventDefault(); var nextState = null; switch (this._state) { case btn.NORMAL: nextState = btn.WAITING; break; case btn.WAITING: nextState = btn.ACTIVATED; break; case btn.ACTIVATED: default: nextState = btn.NORMAL; break; } this.setState( nextState ); } window.btn = btn;
})(window);
(function(window)
{ jQuery(window).on('load', init); function init() { jQuery('.btn').each(function(i, e) { new btn(e); }.bind(this)) }
})(window);
Developer | Alexandre Masy |
Username | alexandremasy |
Uploaded | October 01, 2022 |
Rating | 3 |
Size | 4,170 Kb |
Views | 14,168 |
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 |
A Type Scale | 2,386 Kb |
Blink | 2,417 Kb |
AngularJS - UI Router - Example 1 | 4,753 Kb |
Alexandremasy-logo | 2,821 Kb |
Direction-icon | 3,323 Kb |
Yp-loader | 2,917 Kb |
Ideation-icon | 3,269 Kb |
Pair Game | 5,662 Kb |
SVG - Color Matrix applied to map | 2,264 Kb |
Bullet Loader | 3,028 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 |
Under construction | GhostRider | 1,642 Kb |
We Simplify animation | Meodai | 48,169 Kb |
Clock Face Idea | Chrisburnell | 3,196 Kb |
Sequence.js - Sliding Horizontal Parallax | Maheshc | 4,537 Kb |
CSS3 Animated buttons | Cguillou | 3,737 Kb |
Tile Animation Thing | Frxnz | 4,332 Kb |
Touch Carousel - last, no gaps. | Berkin | 4,332 Kb |
Highbrow Basic HTML Lesson 8 | Kimlarocca | 2,094 Kb |
Font stack | Adrianjacob | 1,868 Kb |
Hexagons | Ashmind | 4,360 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!