WIP - Fun with Buttons

In this example below you will see how to do a WIP - Fun with Buttons with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by praliedutzel, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright praliedutzel ©
  • HTML
  • CSS
  • JavaScript
    <div class="tab-btn">
    <button type="submit" title="Click to Subscribe"><span>Subscribe</span></button>
</div>

/*Downloaded from https://www.codeseek.co/praliedutzel/wip-fun-with-buttons-vBsGi */
    body {
  background: #ccc;
}

.tab-btn {
	position: absolute;
}

.tab-btn button {
	background: transparent;
	width: 40px;
	height: 40px;
	border: 2px solid #fff;
	border-radius: 50%;
	outline: none;
	cursor: pointer;
}

.tab-btn button:before,
.tab-btn button:after {
	content: '';
	display: block;
	position: absolute;
	background: #fff;
	width: 2px;
	height: 15px;
	-webkit-transition: all 0.5s;
	-moz-transition: all 0.5s;
	-o-transition: all 0.5s;
	transition: all 0.5s;
}

.tab-btn button:before {
	top: 8px;
	left: 21px;
	-webkit-transform: rotate(-45deg);
	-moz-transform: rotate(-45deg);
	-ms-transform: rotate(-45deg);
	-o-transform: rotate(-45deg);
	transform: rotate(-45deg);
}

.tab-btn button:after {
	top: 18px;
	left: 21px;
	-webkit-transform: rotate(45deg);
	-moz-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	-o-transform: rotate(45deg);
	transform: rotate(45deg);
}

.tab-btn button:hover,
.tab-btn button.clicked { background: #fff; }

.tab-btn button:hover:before,
.tab-btn button:hover:after { background: #de2027; }

.tab-btn button.clicked:before {
	background: #de2027;
	height: 20px;
	top: 10px;
	left: 23px;
	-webkit-transform: rotate(25deg);
	-moz-transform: rotate(25deg);
	-ms-transform: rotate(25deg);
	-o-transform: rotate(25deg);
	transform: rotate(25deg);
}

.tab-btn button.clicked:after {
	background: #de2027;
	height: 12px;
	top: 20px;
	left: 15px;
	-webkit-transform: rotate(125deg);
	-moz-transform: rotate(125deg);
	-ms-transform: rotate(125deg);
	-o-transform: rotate(125deg);
	transform: rotate(125deg);
}

.tab-btn button span {
	width: 0;
	height: 0;
	overflow: hidden;
	visibility: hidden;
}


/*Downloaded from https://www.codeseek.co/praliedutzel/wip-fun-with-buttons-vBsGi */
    $('.tab-btn button').click(function() {
  $('.tab-btn button').toggleClass('clicked');
});

Comments