Spin button

Developer
Size
3,935 Kb
Views
18,216

How do I make an spin button?

Circular button with spinning border for hover indication. What is a spin button? How do you make a spin button? This script and codes were developed by Ross B on 23 November 2022, Wednesday.

Spin button Previews

Spin button - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Spin button</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ *, *:after, *:before { box-sizing: border-box;
}
body { display: -webkit-box; display: -moz-box; display: box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: flex; -webkit-align-content: center; -moz-align-content: center; align-content: center; -ms-flex-line-pack: center; color: #353535; min-height: 100vh; font-family: 'Open Sans', sans-serif; font-size: 14px; text-align: center; background-color: lightgreen;
}
.container { padding: 60px 80px; background-color: white; box-shadow: 0 0 4px 1px #BBB; margin: auto; text-align: center;
}
.wrap { position: relative; width: 80px; height: 80px; margin: 20px auto 30px auto;
}
.wrap:last-child { margin-bottom: 0;
}
.clicker { background-color: white; outline: none; font-weight: 600; position: absolute; cursor: pointer; padding: 0; border: none; height: 64px; width: 64px; left: 8px; top: 8px; border-radius: 100px; z-index: 2;
}
.clicker:active { transform: translate(0, 1px); height: 63px; box-shadow: 0px 1px 0 0 #bebebe inset;
}
.circle { position: relative; border-radius: 40px; width: 80px; height: 80px; z-index: 1;
}
.circle.third { border-radius: 0;
}
.clicker.faster:hover + .circle, .clicker.faster:active + .circle { animation: rotator linear .4s infinite;
}
.clicker.fast:hover + .circle, .clicker.fast:active + .circle { animation: rotator linear .5s infinite;
}
.clicker:hover + .circle, .clicker:active + .circle { animation: rotator linear .8s infinite;
}
@keyframes rotator { from { transform: rotate(0deg); } to { transform: rotate(360deg); }
}
.angled { background-image: linear-gradient(45deg, white 0%, white 30%, #14beeb 30%, #14beeb 70%, white 70%, white 100%);
}
.angled.second { background-image: linear-gradient(white 0%, white 30%, #faa078 30%, #faa078 70%, white 70%, white 100%);
}
.angled.third { background-image: linear-gradient(45deg, white 0%, white 30%, #82e687 30%, #82e687 70%, white 70%, white 100%);
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <link href='https://fonts.googleapis.com/css?family=Open+Sans:600,700' rel='stylesheet' type='text/css'> <div class="container">
Medium, border-radius, 45deg background
<div class="wrap"> <button class="clicker">press</button> <div class="circle angled"></div> </div>
Fast, border-radius, vertical background <div class="wrap"> <button class="clicker fast">press</button> <div class="circle angled second"></div> </div>
Faster, no border-radius, 45 deg background
<div class="wrap"> <button class="clicker faster">press</button> <div class="circle angled third"></div> </div>
</div>
</body>
</html>

Spin button - Script Codes CSS Codes

*, *:after, *:before { box-sizing: border-box;
}
body { display: -webkit-box; display: -moz-box; display: box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: flex; -webkit-align-content: center; -moz-align-content: center; align-content: center; -ms-flex-line-pack: center; color: #353535; min-height: 100vh; font-family: 'Open Sans', sans-serif; font-size: 14px; text-align: center; background-color: lightgreen;
}
.container { padding: 60px 80px; background-color: white; box-shadow: 0 0 4px 1px #BBB; margin: auto; text-align: center;
}
.wrap { position: relative; width: 80px; height: 80px; margin: 20px auto 30px auto;
}
.wrap:last-child { margin-bottom: 0;
}
.clicker { background-color: white; outline: none; font-weight: 600; position: absolute; cursor: pointer; padding: 0; border: none; height: 64px; width: 64px; left: 8px; top: 8px; border-radius: 100px; z-index: 2;
}
.clicker:active { transform: translate(0, 1px); height: 63px; box-shadow: 0px 1px 0 0 #bebebe inset;
}
.circle { position: relative; border-radius: 40px; width: 80px; height: 80px; z-index: 1;
}
.circle.third { border-radius: 0;
}
.clicker.faster:hover + .circle, .clicker.faster:active + .circle { animation: rotator linear .4s infinite;
}
.clicker.fast:hover + .circle, .clicker.fast:active + .circle { animation: rotator linear .5s infinite;
}
.clicker:hover + .circle, .clicker:active + .circle { animation: rotator linear .8s infinite;
}
@keyframes rotator { from { transform: rotate(0deg); } to { transform: rotate(360deg); }
}
.angled { background-image: linear-gradient(45deg, white 0%, white 30%, #14beeb 30%, #14beeb 70%, white 70%, white 100%);
}
.angled.second { background-image: linear-gradient(white 0%, white 30%, #faa078 30%, #faa078 70%, white 70%, white 100%);
}
.angled.third { background-image: linear-gradient(45deg, white 0%, white 30%, #82e687 30%, #82e687 70%, white 70%, white 100%);
}
Spin button - Script Codes
Spin button - Script Codes
Home Page Home
Developer Ross B
Username rocbear
Uploaded November 23, 2022
Rating 4.5
Size 3,935 Kb
Views 18,216
Do you need developer help for Spin button?

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!

Ross B (rocbear) Script Codes
Create amazing captions with AI!

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!