Skip to content

Commit

Permalink
Render the timeline post's content only when it reaches the viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmz committed Oct 22, 2024
1 parent 946138b commit 57f61e3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions styles/shared/post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,19 @@ code.inline-code {
}
}

.timeline-post {
/**
* Render the post's content only when it reaches the viewport.
*/
content-visibility: auto;

/**
* Empirically determined height for the post's placeholder. It will be
* replaced with the actual height of the post when it reaches the viewport.
*/
contain-intrinsic-size: auto calc(440px - min(100vw, 800px) / 6);
}

.timeline-post.direct-post {
--bg-color: #eee;
--arrow-color: #fff;
Expand Down

0 comments on commit 57f61e3

Please sign in to comment.