Attempt to fix aimation of question reveals

This commit is contained in:
Leon Mika 2025-06-19 04:51:37 +02:00
parent fd190a5e3d
commit 543c1790de
3 changed files with 27 additions and 11 deletions

View file

@ -8,6 +8,11 @@
<link rel="stylesheet" href="./fontello/css/fontello.css"> <link rel="stylesheet" href="./fontello/css/fontello.css">
</head> </head>
<body> <body>
<div class="offscreen">
<i class="icon-cancel"></i>
<i class="icon-ok"></i>
</div>
<div class="question" data-controller="picker" data-picker-answer-value="2"> <div class="question" data-controller="picker" data-picker-answer-value="2">
<p>What is the thing and the other thing that goes here?</p> <p>What is the thing and the other thing that goes here?</p>

View file

@ -13,6 +13,9 @@ export default class extends Controller {
submitAnswer(ev) { submitAnswer(ev) {
ev.preventDefault(); ev.preventDefault();
this.element.classList.add("reveal");
window.setTimeout(() => {
this.radioTargets.forEach(e => { this.radioTargets.forEach(e => {
e.disabled = true; e.disabled = true;
if (e.value === this.answerValue) { if (e.value === this.answerValue) {
@ -21,5 +24,6 @@ export default class extends Controller {
e.classList.add("wrong"); e.classList.add("wrong");
} }
}); });
}, 1);
} }
}; };

View file

@ -1,3 +1,13 @@
div.offscreen {
position: fixed;
left: -100px;
top: -100px;
}
div.question.reveal label {
transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
label:has(input[type=radio]) { label:has(input[type=radio]) {
width: 100%; width: 100%;
@ -9,9 +19,6 @@ label:has(input[type=radio]) {
text-align: center; text-align: center;
position: relative; position: relative;
transition: background-color 0.2s, color 0.2s, border-color 0.2s;
-webkit-backface-visibility: hidden;
margin-block: 0.5em; margin-block: 0.5em;
padding-block: 0.4em; padding-block: 0.4em;
font-size: 0.9em; font-size: 0.9em;