Testing hugo
This commit is contained in:
commit
e3975962fa
327 changed files with 17224 additions and 0 deletions
32
public/js/toggleLayout.js
Normal file
32
public/js/toggleLayout.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
document.getElementById("btnGrid").addEventListener("click", makeGrid);
|
||||
document.getElementById("btnRows").addEventListener("click", makeRows);
|
||||
window.addEventListener("resize", adjustListAtMobile);
|
||||
|
||||
document.getElementById("rows").style.fill = "var(--grey)";
|
||||
|
||||
let listRemoveWidth = window.matchMedia("(max-width: 735px)");
|
||||
let listAddWidth = window.matchMedia("(min-width: 735px)");
|
||||
let isList = false;
|
||||
|
||||
function adjustListAtMobile(){
|
||||
if (listRemoveWidth.matches) {
|
||||
document.getElementById("articlesList").classList.remove("articles-list-container-alt");
|
||||
}
|
||||
else if (listAddWidth.matches && isList === true) {
|
||||
document.getElementById("articlesList").classList.add("articles-list-container-alt");
|
||||
}
|
||||
}
|
||||
|
||||
function makeGrid(){
|
||||
document.getElementById("articlesList").classList.remove("articles-list-container-alt");
|
||||
document.getElementById("tiles").style.fill = "var(--primary)";
|
||||
document.getElementById("rows").style.fill = "var(--grey)";
|
||||
isList = false;
|
||||
}
|
||||
|
||||
function makeRows(){
|
||||
document.getElementById("articlesList").classList.add("articles-list-container-alt");
|
||||
document.getElementById("rows").style.fill = "var(--primary)";
|
||||
document.getElementById("tiles").style.fill = "var(--grey)";
|
||||
isList = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue