A Pinterest-like Blog Home Layout

pinterest-like-blog-home-layout-sshot-00

Demo(If the page loads slowly just reload it, the server could be idle for low traffic)

This is the first iteration of a project I started after having discovered the BLOGThESIGN site.

So, ideally this would be a template for a blog home page, with a fixed-on-viewport ‘cover’ with some site info on the left and the main content on the right consisting of an irregular grid of post teasers, arranged in a Pinterest/masonry-like layout. The whole viewport width is partitioned in equal sized columns, where the first column is for the cover and the remaining ones are for the posts.

These post teasers are rendered with a custom (vanilla)Javascript code that loops through them and set their css absolute position according to the target column width, their height and the available container width. This is what I mentioned at the end of the description of the Pinterest Layout demo .

Initially this computation is delayed after all the posst images are loaded, to get the final height of each post. During this phase the masonry layout is approximated with Flexbox, obtaining the same effect/behaviour along the horizontal axis but with post arranged in same-height rows, as can be seen in the first shot:

Pinterest like blog home layout-sshot-01

Pinterest like blog home layout-sshot-02

Note that there are a lots of posts on page to test the performance of the custom layout code. One of the next items on the TODO list is to implement an infinite scrolling solution.

Advertisements

Published by

mgiulio

Front End Developer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s