Fix mistake with readystatechange event

This commit is contained in:
Nicolò P 2021-09-03 09:43:01 +02:00
parent 6f945e72f3
commit 25c5007a09

View File

@ -4,7 +4,7 @@
let homeRE = new RegExp(/(https?:\S+\/$|index.html$)/);
if (homeRE.test(window.location.href)) {
window.addEventListener('load', () => {
document.addEventListener('readystatechange', () => {
let nextimage = 0;
let header = document.querySelector('header');
slider();
@ -27,7 +27,7 @@ if (homeRE.test(window.location.href)) {
'img/fara_bg_11.jpg',
];
if (nextimage >= images.length) {
if (nextimage >= images.length) {
nextimage = 0;
}
header.setAttribute('style', 'background-image : url("' + images[nextimage++] + '");');
@ -76,11 +76,10 @@ window.addEventListener('scroll', event => {
nav.classList.remove('bg-white', 'border');
}
});
window.addEventListener('load', () => {
/**
* Show horizontal nav on mobile
*/
/**
* Show horizontal nav on mobile
*/
document.addEventListener('readystatechange', () => {
let menu = document.querySelector('i');
menu.addEventListener('click', () => {
@ -123,7 +122,6 @@ window.addEventListener('load', () => {
a.addEventListener('click', () => {
aNodes.forEach(n => {
if (n.src) {
let vStr = n.src
.substr(n.src.lastIndexOf('/')+1, n.src.length)
@ -153,7 +151,5 @@ window.addEventListener('load', () => {
overlay.addEventListener('click', () => {
modal.classList.remove('active');
})
}
});