improved wide-cards layout

This commit is contained in:
eclipse 2025-02-12 10:21:52 +01:00
parent 27bd685fc8
commit d16d5a4b23
3 changed files with 38 additions and 13 deletions

View File

@ -1,5 +1,6 @@
--- ---
title: Romane title: Romane
summary: Fantasy, SF, Krimi, Kinder- und Jugendbuch, …
author: Tobias Radloff author: Tobias Radloff
lang: de lang: de
category: Romane category: Romane
@ -11,18 +12,18 @@ featured_images:
- pic: images/romane/amoralisch.jpg - pic: images/romane/amoralisch.jpg
post: romane/amoralisch.html post: romane/amoralisch.html
alt: Amoralisch alt: Amoralisch
y_offset: -500px y_offset: 50%
- pic: images/romane/schwarzspeicher.jpg - pic: images/romane/schwarzspeicher.jpg
post: romane/schwarzspeicher post: romane/schwarzspeicher
alt: Schwarzspeicher alt: Schwarzspeicher
y_offset: -1140px y_offset: 65%
- pic: images/romane/satinavs-auge.jpg - pic: images/romane/satinavs-auge.jpg
post: romane/satinavs-auge post: romane/satinavs-auge
alt: Satinavs Auge alt: Satinavs Auge
y_offset: -900px y_offset: 8%
- pic: images/romane/das-geheimnis-der-lady-luck.jpg - pic: images/romane/das-geheimnis-der-lady-luck.jpg
post: romane/das-geheimnis-der-lady-luck post: romane/das-geheimnis-der-lady-luck
alt: Das Geheimnis der Lady Luck alt: Das Geheimnis der Lady Luck
y_offset: -300px y_offset: 55%
--- ---

View File

@ -275,6 +275,25 @@ a {
/* settings for slide shows on wide cards */ /* settings for slide shows on wide cards */
/* see https://www.smashingmagazine.com/2012/04/pure-css3-cycling-slideshow/ */ /* see https://www.smashingmagazine.com/2012/04/pure-css3-cycling-slideshow/ */
.wcard {
display: flex;
flex-flow: row wrap;
column-gap: calc(var(--pico-nav-element-spacing-horizontal) * 2);
.wcard-gallery {
flex: 1 0 calc((100% - (2 * var(--pico-nav-element-spacing-horizontal))) * 0.618);
min-width: 300px;
}
.wcard-title {
flex: 1 0 calc((100% - (2 * var(--pico-nav-element-spacing-horizontal))) * 0.382);
min-width: 185px;
display: flex;
justify-content: center;
align-items: center;
}
}
.wcard-gallery { .wcard-gallery {
height: var(--card-height); height: var(--card-height);
position: relative; position: relative;
@ -296,13 +315,20 @@ a {
list-style: none; list-style: none;
height: var(--card-height); height: var(--card-height);
width: 100%; width: 100%;
animation: image-slide 20s ease-in-out infinite; animation: image-slide 20s ease-in-out infinite;
left: -100%; left: -100%;
opacity: 0; opacity: 0;
z-index: 0; z-index: 0;
a {
display: block;
position: absolute;
overflow-y: visible;
height: 100%;
}
img { img {
bottom: 0%;
width: 100%; width: 100%;
position: relative; position: relative;
} }
@ -329,7 +355,6 @@ a {
li.wcard-image:hover .wcard-tooltip { li.wcard-image:hover .wcard-tooltip {
opacity: 1; opacity: 1;
} }
} }
@keyframes image-slide { @keyframes image-slide {

View File

@ -1,19 +1,19 @@
{% extends "page.html" %} {% extends "page.html" %}
{% block content_body %} {% block content_body %}
{# build list of pages where the slugs correspond to an entries in page.wide_cards; some hackiness required to keep the {# build list of pages where the slugs correspond to an entry in page.wide_cards; some hackiness required to keep the
original order #} original order #}
{% set wcards = [] %} {% set wcards = [] %}
{% for wide_card in page.wide_cards %} {% for wide_card in page.wide_cards %}
{% do wcards.append(pages | selectattr("slug", "==", wide_card) | list | first) if pages | selectattr("slug", "==", {% do wcards.append(pages | selectattr("slug", "==", wide_card) | list | first) if pages | selectattr("slug", "==",
wide_card) | list | first is defined %} wide_card) | list | first is defined %}
{% endfor %} {% endfor %}
{# now we can finally iterate over the pages listed in page.wide_cards #} {# now we can finally iterate over the corcect pages #}
{% for wcard in wcards %} {% for wcard in wcards %}
<article class="wcard"> <article class="wcard">
<header> <div class="wcard-title">
<h3><a href="{{ SITEURL }}/{{ wcard.title|lower }}/">{{ wcard.title }}</a></h3> <h2><a href="{{ SITEURL }}/{{ wcard.title|lower }}/">{{ wcard.title }}</a></h2>
</header> </div>
<div class="wcard-gallery"> <div class="wcard-gallery">
{% if wcard.featured_images is defined %} {% if wcard.featured_images is defined %}
<div class="wcard-gallery-mask"> <div class="wcard-gallery-mask">
@ -21,8 +21,7 @@ wide_card) | list | first is defined %}
{% for image in wcard.featured_images %} {% for image in wcard.featured_images %}
<li class="wcard-image" style="animation-delay: {{ loop.index0 * 5 }}s"> <li class="wcard-image" style="animation-delay: {{ loop.index0 * 5 }}s">
<a href="{{ SITEURL }}/{{ image.post }}"> <a href="{{ SITEURL }}/{{ image.post }}">
<img src="{{ SITEURL }}/{{ image.pic }}" alt="{{ image.alt }}" {% if image.y_offset is defined %} <img src="{{ SITEURL }}/{{ image.pic }}" alt="{{ image.alt }}" {% if image.y_offset is defined %}style="bottom: {{ image.y_offset }};" {% endif %} />
style="top: {{ image.y_offset }};" {% endif %} />
</a> </a>
<div class="wcard-tooltip"> <div class="wcard-tooltip">
<p>{{ image.alt }}</p> <p>{{ image.alt }}</p>