mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-24 06:56:59 +00:00
Fix error when no masonry is found
This commit is contained in:
@@ -7,9 +7,12 @@ function resizeItem(masonry, item){
|
|||||||
|
|
||||||
function resizeAll(){
|
function resizeAll(){
|
||||||
let masonry = document.getElementsByClassName("masonry")[0];
|
let masonry = document.getElementsByClassName("masonry")[0];
|
||||||
|
|
||||||
|
if (!masonry) return;
|
||||||
|
|
||||||
masonry.style.gridAutoRows = "20px"
|
masonry.style.gridAutoRows = "20px"
|
||||||
masonry.style.marginBottom = "80px"
|
masonry.style.marginBottom = "80px"
|
||||||
let allItems = document.getElementsByClassName("masonry-item");
|
let allItems = masonry.getElementsByClassName("masonry-item");
|
||||||
|
|
||||||
for (const item of allItems) {
|
for (const item of allItems) {
|
||||||
resizeItem(masonry, item)
|
resizeItem(masonry, item)
|
||||||
|
|||||||
Reference in New Issue
Block a user