aller en page du footer après un timeout
This commit is contained in:
16
index.html
16
index.html
@@ -42,11 +42,6 @@ body {
|
|||||||
background: linear-gradient(var(--pico-background-color) 60%, transparent);
|
background: linear-gradient(var(--pico-background-color) 60%, transparent);
|
||||||
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;
|
||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user