Click and Hold Button Animation
How do I make an click and hold button animation?
Experimenting with a button that will animate once clicked and hold for 1s. What is a click and hold button animation? How do you make a click and hold button animation? This script and codes were developed by Larry Geams Parangan on 27 November 2022, Sunday.
Click and Hold Button Animation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Click and Hold Button Animation</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Click and Hold Button Animation</h1>
<button class="icon_close hold_trigger"> <span class="text">Hold Me!</span> <span class="spinner"></span>
</button> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Click and Hold Button Animation - Script Codes CSS Codes
body{ background: #F06060;
}
h1{ color: #fff; text-align: center; font-family: Arial; font-size: 50px; font-weight: normal;
}
button{ background: none repeat scroll 0 0 #CB4E4E; border-radius: 50%; box-shadow: 0 8px #AB3C3C; color: #FFFFFF; width: 150px; height: 150px; border: 0px; cursor: pointer; position: relative; font-size: 25px; margin: 5% auto; display: block; outline: none;
}
button:hover{ box-shadow: 0px 5px #AB3C3C; top: 2px;
}
button:active{ box-shadow: 0px 0px #AB3C3C; top: 5px;
}
.spinner{ position: absolute; left: 0; right: 0; top: 6%; moz-border-radius: 50%;
-webkit-border-radius: 50%;
border-radius: 50%;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: 5px solid #fff;
border-left-color: transparent; border-right-color: transparent; border-top-color: transparent;
color: #52b700;
display: block;
font-size: 30px;
height: 135px;
line-height: 50px;
margin: 0 auto;
width: 135px;
-webkit-perspective: 300;
-moz-perspective: 300;
-ms-perspective: 300;
perspective: 300;
-webkit-transform: rotateY(0deg);
-webkit-transform-style: preserve-3d;
-moz-transform: rotateY(0deg);
-moz-transform-style: preserve-3d;
-ms-transform: rotateY(0deg);
-ms-transform-style: preserve-3d;
transform: rotateY(0deg);
transform-style: preserve-3d;
}
.active{ -webkit-animation: spin-cw 1s linear;
-moz-animation: spin-cw 1s linear;
animation: spin-cw 1s linear;
}
@-webkit-keyframes spin-cw { 0% { -webkit-transform:rotate(0deg); } 100% { -webkit-transform:rotate(360deg); }
}
@-moz-keyframes spin-cw { 0% { -moz-transform:rotate(0deg); } 100% { -moz-transform:rotate(360deg); }
}
@-o-keyframes spin-cw { 0% { -o-transform:rotate(0deg); } 100% { -o-transform:rotate(360deg); }
}
@keyframes spin-cw { 0% { transform:rotate(0deg); } 100% { transform:rotate(360deg); }
}
Click and Hold Button Animation - Script Codes JS Codes
var timeout_id = 0, hold_time = 1000, hold_trigger = $('.hold_trigger');
hold_trigger.mousedown(function() { timeout_id = setTimeout(menu_toggle, hold_time);
}).bind('mouseup mouseleave', function() { clearTimeout(timeout_id); $('.spinner').removeClass('active');
});
function menu_toggle() { $('.spinner').addClass('active');
}
Developer | Larry Geams Parangan |
Username | larrygeams |
Uploaded | November 27, 2022 |
Rating | 3 |
Size | 2,433 Kb |
Views | 30,360 |
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 |
Pure CSS Login Form | 2,343 Kb |
Browser Detection - Google Chrome | 2,866 Kb |
Pure CSS Checklist Icon | 2,121 Kb |
Slide Toggle Navigation | 2,590 Kb |
See Through | 77,410 Kb |
The Android Story | 4,745 Kb |
Works by Category | 2,676 Kb |
Simple E-Commerce | 2,919 Kb |
Window.onload | 2,429 Kb |
One Page Navigation | 2,534 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 |
CSS Google Now | Jackmoran | 3,196 Kb |
Hello People | Danburrows | 2,365 Kb |
Pure CSS Animated Photo Stack | Depthdev | 2,486 Kb |
Sample Profile Screen | OurDailyBread | 5,375 Kb |
Flexbox Test | Icutpeople | 2,486 Kb |
Transition | Shayhowe | 1,632 Kb |
Simple CSS loader. | Cabrera | 2,574 Kb |
Out of the blue | Giaco | 2,537 Kb |
Replace url via jquery | Serluk | 1,429 Kb |
Find The Penguin | Lelder | 2,212 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!