forked from avana/sito-hackit-20
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
console.log('start!')
|
|
var logo = document.getElementById('logo-img')
|
|
function ruotaLogo() {
|
|
logo.style.transform = 'rotate(' + window.pageYOffset/5+'deg)'
|
|
}
|
|
function scrollSetup() {
|
|
"use strict";
|
|
let last_known_scroll_position = 0;
|
|
let ticking = false;
|
|
|
|
function doSomething(scroll_pos) {
|
|
// Do something with the scroll position
|
|
}
|
|
|
|
window.addEventListener('scroll', function(e) {
|
|
last_known_scroll_position = window.scrollY;
|
|
|
|
if (!ticking) {
|
|
window.requestAnimationFrame(function() {
|
|
|
|
ruotaLogo()
|
|
ticking = false;
|
|
});
|
|
|
|
ticking = true;
|
|
}
|
|
});
|
|
}
|
|
ruotaLogo()
|
|
scrollSetup()
|
|
logo.addEventListener('click', function() {
|
|
var menu = document.querySelector('#menu-row')
|
|
if (window.getComputedStyle(menu).display == 'none') {
|
|
menu.style.display = 'block'
|
|
// menu.scrollIntoView()
|
|
} else {
|
|
menu.style.display = 'none'
|
|
}
|
|
console.log('cliccato')
|
|
})
|
|
})
|