Better cleaning of styles written by the js code
This commit is contained in:
parent
96c16f5dd4
commit
ce7acda52f
|
|
@ -17,8 +17,8 @@ sound.load();
|
|||
async function sessionStartupAnimation()
|
||||
{
|
||||
// Page setup
|
||||
let all_default_elements = document.body.querySelectorAll("*");
|
||||
all_default_elements.forEach((elem) => elem.style.opacity = 0);
|
||||
let default_elements = document.body.querySelectorAll("*");
|
||||
default_elements.forEach((elem) => elem.style.opacity = 0);
|
||||
|
||||
// Get quotes possibilities
|
||||
// Not the most optimised way, but it's working
|
||||
|
|
@ -87,12 +87,17 @@ async function sessionStartupAnimation()
|
|||
|
||||
await waitForAnimationEnd(text_elem, "opacity-fade-out");
|
||||
|
||||
// Remove them and fade in for page content
|
||||
// Remove quote and fade in page content
|
||||
document.body.removeChild(author_elem);
|
||||
document.body.removeChild(text_elem);
|
||||
|
||||
all_default_elements.forEach((elem) => elem.style.animation = "opacity-fade-in 0.5s");
|
||||
all_default_elements.forEach((elem) => elem.style.opacity = 1);
|
||||
default_elements.forEach((default_elem) => {
|
||||
default_elem.style.animation = "opacity-fade-in 0.5s ease-in";
|
||||
default_elem.onanimationend = () => {
|
||||
default_elem.onanimationend = null;
|
||||
default_elem.removeAttribute("style");
|
||||
}
|
||||
});
|
||||
|
||||
window.onkeydown = null;
|
||||
}
|
||||
|
|
@ -125,7 +130,7 @@ window.onkeydown = () => {
|
|||
|
||||
// Only start animation once per session
|
||||
window.onload = () => {
|
||||
document.body.style.opacity = 1;
|
||||
document.body.removeAttribute("style");
|
||||
|
||||
if(!sessionStorage.getItem("hasExecutedSessionStartupAnimation"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue