Test JS modules...
This commit is contained in:
59
index.html
59
index.html
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script src="" type="module"></script>
|
||||
<script src="js/ui.js" type="module"></script>
|
||||
<title>Nel cielo di Fara</title>
|
||||
</head>
|
||||
<body>
|
||||
@@ -35,61 +35,4 @@
|
||||
<p><img src="img/FESR_BARRA_BENEFICIARI_DEF.jpg" class="logos" alt="Loghi enti beneficiari"></p>
|
||||
</footer>
|
||||
</body>
|
||||
<!-- MOOOVE AWAAAAAYY -->
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', () => {
|
||||
let navlinks = Array.from(document.querySelectorAll('#links a'));
|
||||
|
||||
navlinks.forEach(element => {
|
||||
let ref = element.href.substr(element.href.lastIndexOf('/'), element.href.length);
|
||||
|
||||
if (window.location.href.includes(ref) || element.href.includes('index.html')) {
|
||||
element.setAttribute('class', 'active');
|
||||
}
|
||||
});
|
||||
|
||||
let images = [
|
||||
'img/fara_background.jpg',
|
||||
'img/fara_bg_2.jpg',
|
||||
'img/fara_bg_3.jpg',
|
||||
'img/fara_bg_4.jpg',
|
||||
'img/fara_bg_5.jpg',
|
||||
];
|
||||
let nextimage = 0;
|
||||
let header = document.querySelector('header');
|
||||
|
||||
slider();
|
||||
/**
|
||||
* Fade in??
|
||||
*/
|
||||
function slider () {
|
||||
opacity = 1;
|
||||
|
||||
if(nextimage >= images.length) {
|
||||
nextimage = 0;
|
||||
}
|
||||
header.style =
|
||||
'background-image : url("' +images[nextimage++] + '");';
|
||||
setTimeout(slider, 3000);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('scroll', event => {
|
||||
let nav = document.querySelector('#nav');
|
||||
let links = document.querySelector('#links');
|
||||
|
||||
if (window.pageYOffset !== 0) {
|
||||
nav.classList.add('bg-white');
|
||||
nav.classList.remove('text-gray');
|
||||
links.classList.add('nav-dark');
|
||||
links.classList.remove('nav-light');
|
||||
}
|
||||
else {
|
||||
nav.classList.add('text-gray');
|
||||
nav.classList.remove('bg-white');
|
||||
links.classList.add('nav-light');
|
||||
links.classList.remove('nav-dark');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user