Reflowable column-grid-based gallery layout question (example link)

I’ve been interested in making a little portfolio website thingy for myself that utilizes a similar sort of grid as the website linked. I have very little knowledge related to CSS and website building in general, so I’m really struggling with wrapping my head around the way things are organized there.

It appears to be using custom JS code alongside a 7-column grid to reflow and place content based on the viewfinder measurements, which I think is supported by the way absolute positions are assigned to each of the block elements. What exactly is the purpose for the grid JS stuff? Could there be a known and more accessible alternative to doing that? I apologize for not getting proper knowledge before asking this; however, I am very interested in knowing the inner workings now of all times. Assume I know nothing about JS.