초간단 progress bar 소스입니다.
<div class="progress-area">
<div class="progress"></div>
</div>
<div class="btn">Click me!</div>
.progress-area{
width:500px;
height:50px;
background:#e1e1e1;
border:3px solid #b1b1b1;
margin:30px;
position:relative;
}
.progress{
position:absolute;
width:100%;
height:100%;
left:0;
top:0;
}
.progress.on{
background:#b1b1b1;
animation:progress 3s linear;
animation-fill-mode:forwards;
}
.btn{
width:200px;
height:50px;
background:#b1b1b1;
text-align:center;
line-height:50px;
margin:0 0 0 30px;
cursor:pointer;
}
.btn:active{
background:#ccc;
}
@keyframes progress{
from{
width:0;
}to{
width:100%;
}
}
const btn = document.querySelector('.btn');
const progress = document.querySelector('.progress');
btn.addEventListener('click',function(event){
progress.classList.add('on');
});
'coding > web' 카테고리의 다른 글
css flip horizontal (0) | 2021.07.18 |
---|---|
css, jquery> 사이드바 + 아코디언 메뉴 checkbox checked , transition (0) | 2021.07.16 |
javascript Timer 타이머 SetTimeout(), clearTimeout() (0) | 2021.06.24 |
jQuery 아코디언 메뉴, 사이드바 메뉴 slideUp, slideDown, accordion menu (0) | 2021.06.22 |
jquery 메뉴바 스크롤 내렸을때 스타일변경 (4) | 2020.04.03 |