Skip to content

Commit 9851158

Browse files
committed
mathRaceGame: fixed the height problem for the settings-menu
Signed-off-by: Marcel Petrick <mail@marcelpetrick.it>
1 parent 6eda771 commit 9851158

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

mathRaceGame/index.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@
6262
text-align: center;
6363
margin-top: 20px;
6464
}
65+
#settings input[type="number"] {
66+
padding: 6px;
67+
height: 16px;
68+
font-size: 16px;
69+
}
70+
#settings input[type="color"] {
71+
height: 32px;
72+
width: 50px;
73+
vertical-align: middle;
74+
}
6575
#countdown {
6676
font-size: 48px;
6777
text-align: center;
@@ -115,6 +125,7 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
115125
ai_car = document["ai-car"]
116126
track_div = document["track"]
117127
countdown_div = document["countdown"]
128+
color_input = document["car-color"]
118129

119130
# Utility Functions
120131
def move_car(car, steps):
@@ -187,7 +198,7 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
187198

188199
NUM_QUESTIONS = int(document["num-questions"].value)
189200
AI_INTERVAL_MS = int(document["ai-speed"].value)
190-
player_car.style.backgroundColor = document["car-color"].value
201+
player_car.style.backgroundColor = color_input.value
191202

192203
track_width = track_div.offsetWidth
193204
car_width = player_car.offsetWidth
@@ -217,6 +228,10 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
217228
countdown_div.text = "3"
218229
start_countdown()
219230

231+
def update_car_color(ev):
232+
player_car.style.backgroundColor = color_input.value
233+
234+
color_input.bind("input", update_car_color)
220235
document["start-btn"].bind("click", on_start_click)
221236
</script>
222237
</body>

0 commit comments

Comments
 (0)