├── Quiz - starter template.rar ├── README.md ├── img ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── css.png ├── html.png ├── js.png └── score.png ├── index.html ├── quiz.js └── style.css /Quiz - starter template.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/Quiz - starter template.rar -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Multiple-Choice-Quiz-JavaScript 2 | Today we're going to create a multiple choice quiz using JavaScript, in this quiz, the user will have to choose the correct answer out of three choices, in less than 10 seconds, if the user didn't answer the question in 10sec, it will go to the next question automatically, and the question is marked wrong. the user has a progress bar, that shows the total number of question, and also if the user answered a question correctly or not. 3 | 4 | Watch The Tutorial On Youtube: 5 | https://www.youtube.com/watch?v=49pYIMygIcU 6 | 7 | 8 | -------------------------------------------------------------------------------- /img/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/1.png -------------------------------------------------------------------------------- /img/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/2.png -------------------------------------------------------------------------------- /img/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/3.png -------------------------------------------------------------------------------- /img/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/4.png -------------------------------------------------------------------------------- /img/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/5.png -------------------------------------------------------------------------------- /img/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/css.png -------------------------------------------------------------------------------- /img/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/html.png -------------------------------------------------------------------------------- /img/js.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/js.png -------------------------------------------------------------------------------- /img/score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeExplainedRepo/Multiple-Choice-Quiz-JavaScript/d06f850c3f35c789d053346f216f305d6c9f2ed6/img/score.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |"+ q.question +"
"; 56 | qImg.innerHTML = ""+ scorePerCent +"%
"; 153 | } 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body{ 2 | font-size: 20px; 3 | font-family: monospace; 4 | } 5 | 6 | #container{ 7 | margin : 20px auto; 8 | background-color: white; 9 | height: 300px; 10 | width : 700px; 11 | border-radius: 5px; 12 | box-shadow: 0px 5px 15px 0px; 13 | position: relative; 14 | } 15 | #start{ 16 | font-size: 1.5em; 17 | font-weight: bolder; 18 | word-break: break-all; 19 | width:100px; 20 | height:150px; 21 | border : 2px solid lightgrey; 22 | text-align: center; 23 | cursor: pointer; 24 | position: absolute; 25 | left:300px; 26 | top:50px; 27 | color : lightgrey; 28 | } 29 | #start:hover{ 30 | border: 3px solid lightseagreen; 31 | color : lightseagreen; 32 | } 33 | 34 | #qImg{ 35 | width : 200px; 36 | height : 200px; 37 | position: absolute; 38 | left : 0px; 39 | top : 0px; 40 | } 41 | #qImg img{ 42 | width : 200px; 43 | height : 200px; 44 | border-top-left-radius: 5px; 45 | } 46 | 47 | #question{ 48 | width:500px; 49 | height : 125px; 50 | position: absolute; 51 | right:0; 52 | top:0; 53 | } 54 | #question p{ 55 | margin : 0; 56 | padding : 15px; 57 | font-size: 1.25em; 58 | } 59 | 60 | #choices{ 61 | width : 480px; 62 | position: absolute; 63 | right : 0; 64 | top : 125px; 65 | padding : 10px 66 | } 67 | .choice{ 68 | display: inline-block; 69 | width : 135px; 70 | text-align: center; 71 | border : 1px solid grey; 72 | border-radius: 5px; 73 | cursor: pointer; 74 | padding : 5px; 75 | } 76 | .choice:hover{ 77 | border : 2px solid grey; 78 | font-weight: bold; 79 | } 80 | 81 | #timer{ 82 | position: absolute; 83 | height : 100px; 84 | width : 200px; 85 | bottom : 0px; 86 | text-align: center; 87 | } 88 | #counter{ 89 | font-size: 3em; 90 | } 91 | #btimeGauge{ 92 | width : 150px; 93 | height : 10px; 94 | border-radius: 10px; 95 | background-color: lightgray; 96 | margin-left : 25px; 97 | } 98 | #timeGauge{ 99 | height : 10px; 100 | border-radius: 10px; 101 | background-color: mediumseagreen; 102 | margin-top : -10px; 103 | margin-left : 25px; 104 | } 105 | #progress{ 106 | width : 500px; 107 | position: absolute; 108 | bottom : 0px; 109 | right : 0px; 110 | padding:5px; 111 | text-align: right; 112 | } 113 | .prog{ 114 | width : 25px; 115 | height : 25px; 116 | border: 1px solid #000; 117 | display: inline-block; 118 | border-radius: 50%; 119 | margin-left : 5px; 120 | margin-right : 5px; 121 | } 122 | #scoreContainer{ 123 | margin : 20px auto; 124 | background-color: white; 125 | opacity: 0.8; 126 | height: 300px; 127 | width : 700px; 128 | border-radius: 5px; 129 | box-shadow: 0px 5px 15px 0px; 130 | position: relative; 131 | display: none; 132 | } 133 | #scoreContainer img{ 134 | position: absolute; 135 | top:100px; 136 | left:325px; 137 | } 138 | #scoreContainer p{ 139 | position: absolute; 140 | display: block; 141 | width : 59px; 142 | height :59px; 143 | top:130px; 144 | left:325px; 145 | font-size: 1.5em; 146 | font-weight: bold; 147 | text-align: center; 148 | } 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | --------------------------------------------------------------------------------