매우 간단한 linke button animation
html
<button class="btn_like">like</button>
css
.btn_like {width: 50px; height: 50px;background: url(https://umings.github.io/images/i_like_off.png) no-repeat center / 50px; cursor: pointer; border:0; font-size:0; margin:50px auto; display:block;}
.btn_like.on {background: url(https://umings.github.io/images/i_like_on.png) no-repeat center / 50px; animation: beating .5s 1 alternate;}
@keyframes beating {
0% {transform: scale(1);}
40% {transform: scale(1.25);}
70% {transform: scale(0.9);}
100% {transform: scale(1);}
}
js *jquery 필요
$('.btn_like').click(function () {
$(this).toggleClass("on")
});
728x90
'퍼블리싱 > HTML | CSS | Javascript' 카테고리의 다른 글
html파일 include 해서 사용하기 (0) | 2023.09.22 |
---|---|
글자수에 따라 ellipsis 처리하기 Setting a max character length (0) | 2023.09.21 |
간단한 css gradient shadow animation (0) | 2023.09.20 |
scroll down button effect only css (0) | 2023.09.18 |
button hover underline animation only css (0) | 2023.09.18 |