aller en page du footer après un timeout

This commit is contained in:
2026-02-10 20:35:24 +01:00
parent cf8e4f59eb
commit 6155ab4bb5

View File

@@ -43,11 +43,6 @@ body {
text-shadow: 0 0 10px var(--pico-background-color); text-shadow: 0 0 10px var(--pico-background-color);
} }
body > main {
margin: -5rem;
padding: 5rem;
}
body > footer { body > footer {
position: sticky; position: sticky;
bottom: 0; bottom: 0;
@@ -171,8 +166,10 @@ question.onkeydown = function(e) {
}; };
question.onfocus = function() { question.onfocus = function() {
window.onresize(); window.setTimeout(() => {
formulaire.scrollIntoView({ block: 'start', behavior: 'smooth' }); window.onresize();
footer.scrollIntoView({ block: 'end', behavior: 'smooth' });
}, 200)
}; };
question.onblur = function() { question.onblur = function() {
@@ -235,7 +232,7 @@ formulaire.addEventListener('submit', async (e) => {
let t = 0; let t = 0;
Array.from(reponse).forEach((lettre, i) => { Array.from(reponse).forEach((lettre, i) => {
t += 100 * Math.random() t += 100 * Math.random()
if (lettre == " ") t += 100 if (lettre == " ") t += 50
setTimeout(() => { setTimeout(() => {
if (lettre == "\n") { if (lettre == "\n") {
paragraphe.innerHTML += "<br>"; paragraphe.innerHTML += "<br>";
@@ -333,6 +330,8 @@ if (SpeechRecognition) {
reconnaissance.interimResults = false; reconnaissance.interimResults = false;
reconnaissance.maxAlternatives = 1; reconnaissance.maxAlternatives = 1;
bouton_reconnaissance_vocale.classList.add("contrast") bouton_reconnaissance_vocale.classList.add("contrast")
const placeholder = question.placeholder
question.placeholder = "À votre écoute"
reconnaissance.onresult = function(event) { reconnaissance.onresult = function(event) {
const transcript = event.results[0][0].transcript; const transcript = event.results[0][0].transcript;
@@ -344,6 +343,7 @@ if (SpeechRecognition) {
reconnaissance.onnomatch = function () { reconnaissance.onnomatch = function () {
reconnaissance.stop(); reconnaissance.stop();
bouton_reconnaissance_vocale.classList.remove("contrast") bouton_reconnaissance_vocale.classList.remove("contrast")
question.placeholder = placeholder
}; };
reconnaissance.start(); reconnaissance.start();