fix color

This commit is contained in:
Florian Schmid 2023-04-13 18:31:47 +02:00
parent 82adaca14c
commit 01369bcf90
2 changed files with 7 additions and 12 deletions

View File

@ -52,11 +52,11 @@
<div class="col-6 offset-3 border text-center p-2" id="mainCol"> <div class="col-6 offset-3 border text-center p-2" id="mainCol">
<span class="h2" id="cpuName"></span> <span class="h2" id="cpuName"></span>
<br> <br>
<button class="btn btn-lg bg-info m-1 mt-2" id="btnDesktop" onclick="btnClick(0)">Desktop</button> <button class="btn btn-lg m-1 mt-2" id="btnDesktop" style="background-color: #3CC3FA;" onclick="btnClick(0)">Desktop</button>
<br> <br>
<button class="btn btn-lg bg-info m-1" id="btnLaptop" onclick="btnClick(1)">Laptop</button> <button class="btn btn-lg m-1" id="btnLaptop" style="background-color: #3CC3FA;" onclick="btnClick(1)">Laptop</button>
<br> <br>
<button class="btn btn-lg bg-info m-1" id="btnMobile" onclick="btnClick(2)">Mobile/Embedded</button> <button class="btn btn-lg m-1" id="btnMobile" style="background-color: #3CC3FA;" onclick="btnClick(2)">Mobile/Embedded</button>
<br> <br>
</div> </div>
</div> </div>

13
gst.js
View File

@ -42,17 +42,14 @@ export async function btnClick(typ) {
// 0 -> Desktop // 0 -> Desktop
// 1 -> Laptop // 1 -> Laptop
// 2 -> Mobile/Embedded // 2 -> Mobile/Embedded
// remove bootstrap class
console.log("Button clicked: typ: " + typ + "cpu type: " + currentCpu.type);
let btnDesktop = document.getElementById("btnDesktop"); let btnDesktop = document.getElementById("btnDesktop");
let btnLaptop = document.getElementById("btnLaptop"); let btnLaptop = document.getElementById("btnLaptop");
let btnMobile = document.getElementById("btnMobile"); let btnMobile = document.getElementById("btnMobile");
let btns = [btnDesktop, btnLaptop, btnLaptop]; let btns = [btnDesktop, btnLaptop, btnMobile];
btns.forEach( (el) => {
el.className = el.className.replace("bg-info", "");
})
switch (typ) { switch (typ) {
case 0: case 0:
@ -65,7 +62,6 @@ export async function btnClick(typ) {
btnMobile.style.backgroundColor = "#FF4444"; btnMobile.style.backgroundColor = "#FF4444";
break; break;
} }
// make correct button green and wrong button red!!!! bg-success | bg-danger
switch (currentCpu.type) { switch (currentCpu.type) {
case "Desktop": case "Desktop":
@ -82,8 +78,7 @@ export async function btnClick(typ) {
await delay(2000); await delay(2000);
btns.forEach( (el) => { btns.forEach( (el) => {
el.className = el.className + " bg-info"; el.style.backgroundColor = "#3CC3FA";
el.style.backgroundColor = "";
}) })
nextRound(); nextRound();