function resizeGridItem(item){ grid = document.getElementsByClassName("grid")[0]; rowHeight = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-auto-rows')); rowGap = parseInt(window.getComputedStyle(grid).getPropertyValue('grid-row-gap')); rowSpan = Math.ceil((item.querySelector('.content').getBoundingClientRect().height+rowGap)/(rowHeight+rowGap)); item.style.gridRowEnd = "span "+rowSpan; } function resizeAllGridItems(){ allItems = document.getElementsByClassName("item"); for(x=0;x