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