Fix load flash
This commit is contained in:
@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user