Posts

Showing posts with the label settimeout

Color transition not working with setTimeout. Element should appear smoothy [duplicate]

Color transition not working with setTimeout. Element should appear smoothy [duplicate] This question already has an answer here: Color transition works, if I don't hide the element and then make it appear. const name = document.querySelector(".name"); setTimeout(() => { name.classList.remove("hide"); name.classList.add("color-blue") // name.style.color = "blue"; }, 2000) .name { background-color: orange; display: inline-block; padding: 5px; transition: color 10s; color: transparent; } .color-blue { color: blue; } .hide { display: none } <div class="name hide"> Lebron James </div> If I don't use the class hide and I don't remove it later, the transition works. By hiding it, it does not work. No clue what's going on Thanks for your help This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. ...

setInterval(updateAircoState, 5000); does not fire updateAircoState() [closed]

setInterval(updateAircoState, 5000); does not fire updateAircoState() [closed] I'm trying to build a webserver on an ESP8266 using jQuery and bootstrap. This is my first go at jQuery and bootstrap (and Javascript for that matter). This project is inspired by this blog: "https://github.com/projetsdiy/ESP8266-Webserver-Tutorials". ======Update============ What I have found out after lots of Trail&Error is that I don't know how to start an interval-timer after the document is fully loaded. Also found out that setInterval(<function>, <time>) need to be assigned to a var like setInterval(<function>, <time>) var Timer_updateAirco = setInterval(updateAircoState, 5000); var Timer_updateAirco = setInterval(updateAircoState, 5000); And clearing the timer is like clearInterval(Timer_updateAirco); clearInterval(Timer_updateAirco); What I need to know is how to start an interval timer, executing a function, after the full load of the document. All help...