File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525
2626<body >
2727 <main >
28+ <div class =" progress" ></div >
2829 <div class =" inner" >
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ function next() {
6060 document . querySelector ( `.inputField[step="${ step } "]` ) ?. classList . remove ( 'active' ) ;
6161 step ++ ;
6262 document . querySelector ( `.inputField[step="${ step } "]` ) ?. classList . add ( 'active' ) ;
63+ progress ( ( step / document . querySelectorAll ( '.inputField' ) . length ) * 100 ) ;
6364 } else {
6465 document . getElementById ( 'next' ) ?. classList . add ( 'hidden' ) ;
6566 document . getElementById ( 'create' ) ?. classList . remove ( 'hidden' ) ;
@@ -80,6 +81,7 @@ function back() {
8081 document . querySelector ( `.inputField[step="${ step } "]` ) ?. classList . remove ( 'active' ) ;
8182 step -- ;
8283 document . querySelector ( `.inputField[step="${ step } "]` ) ?. classList . add ( 'active' ) ;
84+ progress ( ( step / document . querySelectorAll ( '.inputField' ) . length ) * 100 ) ;
8385 } else {
8486 document . getElementById ( 'back' ) ?. classList . add ( 'hidden' ) ;
8587 } ;
@@ -146,6 +148,7 @@ function create() {
146148 localStorage . clear ( ) ;
147149} ;
148150
149- // progress bar
150- // radio input
151- // select input
151+ function progress ( percent ) {
152+ const progressBar = document . querySelector ( '.progress' ) ;
153+ progressBar . style . width = percent + '%' ;
154+ } ;
Original file line number Diff line number Diff line change @@ -210,6 +210,17 @@ main {
210210 transition : 0.25s ;
211211 }
212212
213+ > .progress {
214+ position : absolute;
215+ top : 0 ;
216+ left : 0 ;
217+ height : 5px ;
218+ width : 0% ;
219+ background : # ffffff ;
220+ border-radius : 15px ;
221+ transition : width 0.25s ;
222+ }
223+
213224 .inner {
214225 display : flex;
215226 flex-direction : column;
You can’t perform that action at this time.
0 commit comments