38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
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); |