Skip to content

Instantly share code, notes, and snippets.

@rexthecoder
Created March 3, 2023 06:38
Show Gist options
  • Save rexthecoder/77d061818704044a560dede3f3a24fba to your computer and use it in GitHub Desktop.
Save rexthecoder/77d061818704044a560dede3f3a24fba to your computer and use it in GitHub Desktop.
Loader
let intro = document.querySelector('.intro');
let logo = document.querySelector('.logo-header');
let logoSpan = document.querySelectorAll('.logo');
window.addEventListener('load', () => {
setTimeout(() => {
logoSpan.forEach((span, idx) => {
setTimeout(() => {
span.classList.add('active');
}, (idx + 1) * 400)
});
const observer = new MutationObserver((
mutations, obs
) => {
let fltGlassPane = document.querySelector('flt-glass-pane');
if (fltGlassPane) {
setTimeout(() => {
logoSpan.forEach((span, idx) => {
setTimeout(() => {
span.classList.remove('active');
span.classList.add('fade');
}, (idx + 1) * 50)
})
}, 2000)
setTimeout(() => {
intro.style.top = '-100vh';
}, 2300)
obs.disconnect();
return
}
});
observer.observe(document, {
childList: true,
subtree: true,
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment