alex.racine/themes/portfoliGor/assets/js/main.js

38 lines
1.3 KiB
JavaScript
Raw Normal View History

function pushedDown () {
const main = document.getElementsByTagName("main");
const imgTitle = document.getElementsByClassName("title")[0].firstChild.nextElementSibling;
const mainHeader = document.getElementsByClassName("main-header");
console.log(main);
console.log(imgTitle);
if ( window.location.pathname != '/' ){
main[0].classList.toggle("pushed-down");
main[0].classList.toggle("container");
}
imgTitle.classList.toggle("hidden");
mainHeader[0].classList.toggle("main-header-full");
}
function checkResize () {
if (screen.width > 600) {
const checked = document.getElementsByTagName('input')[0].checked;
const main = document.getElementsByTagName("main");
const imgTitle = document.getElementsByClassName("title")[0].firstChild.nextElementSibling;
if (checked == true) {
document.getElementsByTagName('input')[0].checked = false;
document.getElementsByClassName("main-header")[0].classList.toggle("main-header-full");
if ( window.location.pathname != '/' ){
main[0].classList.toggle("pushed-down");
main[0].classList.toggle("container");
}
imgTitle.classList.toggle("hidden");
console.log('test');
}
}
else {
console.log('do nothing')
}
}
window.addEventListener("resize", checkResize);