티스토리 뷰

<div class="progress_wrap">
    <span class="percent">
        <span class="percent_num" id="js_percent_num"></span> %
    </span>
    <span class="progress_bar">
    	<!-- 페이지 진행률 따라 data-percent에 값 삽입 -->
        <strong class="progress_fill" id="js_progress_fill" data-percent="50"></strong>
    </span>
</div>
.progress_wrap{
    width: 1000px;
    .percent{
        display: inline-block;
        margin-right: 20px;
        font-size: 20px;
        vertical-align: middle;
    }
    .progress_bar{
        display: inline-block;
        position: relative;
        width: 80%;
        height: 10px;
        background-color: #ddd;
        border-radius: 5px;
        vertical-align: middle;
        .progress_fill{
            position: absolute;
            height: inherit;
            border-radius: inherit;
            background-color: aqua;
        }
    }
}
function progressBar(){
    var pro_fill = document.getElementById('js_progress_fill');
    var pro_num = document.getElementById('js_percent_num');
    var crt_percent = pro_fill.dataset.percent;

    pro_fill.style.width = crt_percent + "%";
    pro_num.innerText = crt_percent;
}
공지사항