I'm using react js. I try to run the simple code:
setTimeout(() => {
setTimeout(() => {
const element = document.getElementById(‘circle’)
element.style.backgroundColor = ‘red’
}, 3000)
}, 3000)
The CSS of 'circle' is just:
width: 100px;
height: 100px;
border-radius: 50%;
background-color: blue;
transition: background-color 2s;
I run the code and immediate change tab or minimize the screen, waiting more then 6 seconds and go back to the page and then the transition start. For some reason the transition not run if screen not in focus. Any help guys???