Difference between revisions of "Template:Vilnius-Lithuania/footer"

Line 2: Line 2:
 
<head>
 
<head>
 
<link rel="stylesheet" type="text/css" href="https://2020.igem.org/wiki/index.php?title=Template:Vilnius-Lithuania/CSS/footer&action=raw&ctype=text/css" />
 
<link rel="stylesheet" type="text/css" href="https://2020.igem.org/wiki/index.php?title=Template:Vilnius-Lithuania/CSS/footer&action=raw&ctype=text/css" />
<script type="text/javascript" src="https://2020.igem.org/wiki/index.php?title=Template:Vilnius-Lithuania/JS/footer&action=raw&ctype=text/javascript"></script>
+
<!--<script type="text/javascript" src="https://2020.igem.org/wiki/index.php?title=Template:Vilnius-Lithuania/JS/footer&action=raw&ctype=text/javascript"></script>-->
 
</head>
 
</head>
 
<body>
 
<body>
Line 130: Line 130:
 
</div>
 
</div>
 
</div>
 
</div>
 +
        <script>window.addEventListener('load', switchEls)
 +
window.addEventListener('resize', switchEls)
  
 +
function switchEls() {
 +
var footerDOM = document.getElementById("footerWrapper");
 +
if (footerDOM.getAttribute("switched") == "false" && window.outerWidth <= 420) {
 +
var upF = document.getElementById("upperFooter");
 +
var loF = document.getElementById("lowerFooter");
 +
swapElements(upF, loF)
 +
footerDOM.setAttribute("switched", true);
 +
} else if (footerDOM.getAttribute("switched") == "true" && window.outerWidth > 420) {
 +
var upF = document.getElementById("upperFooter");
 +
var loF = document.getElementById("lowerFooter");
 +
swapElements(upF, loF)
 +
footerDOM.setAttribute("switched", false);
 +
}
 +
}
 +
 +
function swapElements(obj1, obj2) {
 +
 +
obj2.nextSibling === obj1 ?
 +
obj1.parentNode.insertBefore(obj2, obj1.nextSibling) :
 +
obj1.parentNode.insertBefore(obj2, obj1);
 +
}
 +
var acc = document.querySelectorAll("#lowerFooter #navigation h2");
 +
var i;
 +
 +
for (i = 0; i < acc.length; i++) {
 +
acc[i].addEventListener("click", function () {
 +
this.classList.toggle("active");
 +
var panel = this.nextElementSibling;
 +
if (panel.style.maxHeight) {
 +
panel.style.maxHeight = null;
 +
} else {
 +
panel.style.maxHeight = panel.scrollHeight + "px";
 +
}
 +
});
 +
}
 +
</script>
 
</body>
 
</body>
 
</html>
 
</html>

Revision as of 15:42, 22 August 2020