Fix load flash

This commit is contained in:
Madison Scott-Clary
2020-03-01 23:22:46 -08:00
parent 63ff1a6a11
commit 3da818c289

View File

@ -25,18 +25,14 @@ function load() {
// Add a listener for the location changing if window width supports it. // Add a listener for the location changing if window width supports it.
if (window.innerWidth >= 960) { if (window.innerWidth >= 960) {
window.addEventListener('popstate', switchTab); window.addEventListener('popstate', switchTab);
document.querySelector('.carousel nav').style.display = 'block';
} else { } else {
window.removeEventListener('popstate', switchTab); window.removeEventListener('popstate', switchTab);
document.querySelector('.carousel nav').style.display = 'none';
} }
} }
// If we enter the page with a hash, select the current item. // If we enter the page with a hash, select the current item.
window.addEventListener('load', () => { switchTab({preventDefault: () => {}});
switchTab({preventDefault: () => {}}); load();
load();
});
window.addEventListener('resize', load); window.addEventListener('resize', load);
// If we enter the page with no hash, select home. // If we enter the page with no hash, select home.