<div>1</div>
<button>reset</button>
@import url(https://fonts.googleapis.com/css?family=Noto+Sans:400,700);
div,
button {
position: absolute;
font: normal normal normal 14px/28px "Noto Sans", sans-serif;
}
div {
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
width: 28px;
height: 28px;
text-align: center;
background: #52D96A;
border-radius: 100%;
color: white;
transition: background .4s ease;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
div:hover {
cursor: pointer;
background: #49c35f;
}
button {
left: calc(50% - 32px);
bottom: 50px;
border: 0;
border-radius: 4px;
padding: 1px 14px;
color: #52D96A;
background: transparent;
border: 2px solid transparent;
transition: border .2s ease;
}
button:hover {
border: 2px solid #52D96A;
cursor: pointer;
}
button:focus {
outline: none
}
.animate {
animation: scaleup 0.4s 1;
}
@-webkit-keyframes scaleup {
0%,
100% {
width: 28px;
height: 28px;
line-height: 28px;
}
50% {
width: 38px;
height: 38px;
line-height: 38px;
}
}
@keyframes scaleup {
0%,
100% {
width: 28px;
height: 28px;
line-height: 28px;
}
50% {
width: 38px;
height: 38px;
line-height: 38px;
}
}
var valuediv = parseInt($("div").text());
$("div").click(function() {
$("div").text(++valuediv);
console.log(valuediv);
$("div").addClass("animate");
$("div")[0].addEventListener("animationend", function() {
$("div").removeClass("animate");
}, false);
});
$("button").click(function() {
valuediv = 1;
$("div").text(valuediv);
});
This Pen doesn't use any external CSS resources.