Toggle theme
문제를 잘 정의하는 것은 문제를 절반 해결한 것이다. - 2023.12
사용자 도구
Toggle theme
로그인
사이트 도구
검색
도구
문서 보기
이전 판
PDF로 내보내기
Fold/unfold all
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
현재 위치:
start
»
wiki
»
howto
»
more_-_progress_bars
wiki:howto:more_-_progress_bars
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
======HOW TO - JavaScript Progress Bar====== <WRAP left notice 80%> * description : How TO - Off-Canvas Menu * author : 오션 * email : shlim@repia.com * lastupdate : 2021-04-12 </WRAP> <WRAP clear></WRAP> \\ ====Ref==== [[https://www.w3schools.com/howto/howto_js_progressbar.asp|How TO - More - JavaScript Progress Bar]]\\ \\ %%JavaScript%%를 사용하여 프로그레스 바 제작 방법을 학습합니다.\\ =====Creating a Progress Bar===== Step 1) Add HTML:\\ ====예제==== <code html> <div id="myProgress"> <div id="myBar"></div> </div> </code> \\ Step 2) Add CSS:\\ ====예제==== <code css> #myProgress { width: 100%; background-color: #ddd; } #myBar { width: 1%; height: 30px; background-color: #4caf50; } </code> \\ Step 3) Add JavaSCript:\\ %%JavaSCript%%를 사용하여 애니메이션 효과가 있는 __다이내믹 프로그레스 바__(Dynamic Progress Bar)를 만듭니다.\\ ====예제==== <code javascript> var i = 0; function move() { if (i == 0) { var elem = document.getElementById("myBar"); var width = 1; var id = setInterval(frame, 10); function frame() { if (width >= 100) { clearInterval(id); i = 0; } else { width++; elem.style.width = width + "%"; } } } } </code> =====Add Labels===== 사용자가 프로세스에서 얼마나 멀리 있는 지를 나타내는 레이블을 추가하려면,\\ 프로그레스 바 내부 (또는 외부)에 새 요소를 추가합니다.\\ \\ Step 1) Add HTML:\\ ====예제==== <code html> <div id="myProgress"> <div id="myBar">10%</div> </div> </code> \\ Step 2) Add CSS: ====예제==== <code css> #myBar { width: 10%; height: 30px; background-color: #4caf50; text-align: center; /* To center it horizontally (if you want) */ line-height: 30px; /* To center it vertically */ color: white; } </code> \\ Step 3) Add JavaScript:\\ ====예제==== <code javascript> var i = 0; function move() { if (i == 0) { var elem = document.getElementById("myBar"); var width = 10; var id = setInterval(frame, 10); function frame() { if (width >= 100) { clearInterval(id); i = 0; } else { width++; elem.style.width = width + "%"; elem.innerHTML = width + "%"; } } } } </code> \\ ====전체 코드==== <HTML> <!DOCTYPE html> <html> <style> #myProgress { width: 100%; background-color: #ddd; } #myBar { width: 10%; height: 30px; background-color: #4caf50; text-align: center; /* To center it horizontally (if you want) */ line-height: 30px; /* To center it vertically */ color: white; } </style> <body> <h1>JavaScript Progress Bar</h1> <div id="myProgress"> <div id="myBar">10%</div> </div> <br> <button onclick="move()">Click Me</button> <script> var i = 0; function move() { if (i == 0) { var elem = document.getElementById("myBar"); var width = 10; var id = setInterval(frame, 10); function frame() { if (width >= 100) { clearInterval(id); i = 0; } else { width++; elem.style.width = width + "%"; elem.innerHTML = width + "%"; } } } } </script> </body> </html> </HTML> {{tag>오션,HOW TO - More - progress Bars }}
/volume1/web/dokuwiki/data/pages/wiki/howto/more_-_progress_bars.txt
· 마지막으로 수정됨: 2023/01/13 18:44 (바깥 편집)
문서 도구
문서 보기
이전 판
역링크
PDF로 내보내기
Fold/unfold all
맨 위로