First working version. Without further parameters it uses big polaroid images. Parameters not tested; TODO: likely sizing should be made mandatory when positioning and we should add min-height or height of the link based on the image and text sizes calculated in python jinja2 code.

This commit is contained in:
Richard Thier 2020-03-04 00:53:06 +01:00
parent aa3cedeaff
commit 34e3c4b5c8
2 changed files with 36 additions and 14 deletions

View File

@ -553,13 +553,17 @@ nav ul ul ul li {
/* END: navmenu */ /* END: navmenu */
/* START: polaroid-group */ /* START: polaroid-group */
.polaroid-line {
width: 70vw;
margin: auto;
}
a.polaroid { a.polaroid {
display: block; display: block;
padding: 10px 10px 25px 10px; padding: 10px 10px 25px 10px;
border: 2px solid #BFBFBF; border: 2px solid #BFBFBF;
/*background-color: white;*/ background-color: white;
z-index: 2; z-index: 2;
font-size: 0.7em;
/* Shadows around the box */ /* Shadows around the box */
-webkit-box-shadow: 5px 5px 6px rgba(149,150,151,0.3); -webkit-box-shadow: 5px 5px 6px rgba(149,150,151,0.3);
-moz-box-shadow: 5px 5px 6px rgba(149,150,151,0.3); -moz-box-shadow: 5px 5px 6px rgba(149,150,151,0.3);
@ -571,23 +575,32 @@ a.polaroid {
-ms-transition: width 1s, height 1s, -ms-transform 1s; -ms-transition: width 1s, height 1s, -ms-transform 1s;
-webkit-transition: width 1s, height 1s, -webkit-transform 1s; -webkit-transition: width 1s, height 1s, -webkit-transform 1s;
-o-transition: width 1s, height 1s,-o-transform 1s; -o-transition: width 1s, height 1s,-o-transform 1s;
text-align: center;
} }
/* Remove rotation and make it visible (z-index) */ /* Remove rotation and make it visible (z-index) */
a.polaroid:hover, a.polaroid:hover,
a.polaroid:focus, a.polaroid:focus,
a.polaroid:active { a.polaroid:active {
z-index: 100; z-index: 100 !important;
-webkit-transform: rotate(0deg); border-color: #BFBFBF;
-moz-transform: rotate(0deg); -webkit-box-shadow: 5px 5px 6px rgba(149,150,151,0.3); /* Same as above */
-ms-transform: rotate(0deg); -moz-box-shadow: 5px 5px 6px rgba(149,150,151,0.3);
transform: rotate(0deg); box-shadow: 5px 5px 6px rgba(149,150,151,0.3);
/* The "!important" keywords is needed to override higher preference of generated inline styling! */
-webkit-transform: rotate(0deg) !important; /* Removes rotation through a transition */
-moz-transform: rotate(0deg) !important;
-ms-transform: rotate(0deg) !important;
transform: rotate(0deg) !important;
} }
a.polaroid img { a.polaroid img {
border: none; border: none;
display: block; display: block;
min-width: 10vw;
max-width: 100%;
max-height: 100%;
margin: auto; /* Centers wth display: block */
} }
/* END: polaroid-group */ /* END: polaroid-group */

View File

@ -2,27 +2,35 @@
<div class="bg-section" style="background: {{ section.background }};"> <div class="bg-section" style="background: {{ section.background }};">
{% endif %} {% endif %}
<section class="polaroid-group baguette" {% if section.css %}style="{{ section.css }}"{% endif %} > <section class="polaroid-group baguette" {% if section.css %}style="{{ section.css }}"{% endif %} >
<div class="polaroid-line" style="width: 100%; height: 33vh;"> <div class="polaroid-line">
{% for image in line %} {% for image in section.images %}
{% set caption = image.text %} {% set caption = image.text %}
{% set custpos = false %}
{% if image.angle %} {% if image.angle %}
{% set angle = image.angle %} {% set angle = image.angle %}
{% else %} {% else %}
{% set angle = 20 %} {% if (loop.index%2 == 1) %}
{% set angle = 15 %}
{% else %}
{% set angle = -15 %}
{% endif %}
{% endif %} {% endif %}
{% if image.x %} {% if image.x %}
{% set x = image.x %} {% set x = image.x %}
{% set custpos = true %}
{% else %} {% else %}
{% set x = "0px" %} {% set x = "0px" %}
{% endif %}
{% if image.y %} {% if image.y %}
{% set y = image.y %} {% set y = image.y %}
{% set custpos = true %}
{% else %} {% else %}
{% set y = "0px" %} {% set y = "0px" %}
{% endif %} {% endif %}
{% if image.z %} {% if image.z %}
{% set z = image.z %} {% set z = image.z %}
{% else %} {% else %}
{% set z = 2 %} {% set z = loop.index %}
{% endif %} {% endif %}
{% set image = Image(image) %} {% set image = Image(image) %}
{{ image.copy() }} {{ image.copy() }}
@ -33,7 +41,7 @@
data-at-1366="{{ image.generate_thumbnail("x1366") }}" data-at-1366="{{ image.generate_thumbnail("x1366") }}"
data-at-1920="{{ image.generate_thumbnail("x1920") }}" data-at-1920="{{ image.generate_thumbnail("x1920") }}"
class="polaroid" class="polaroid"
style="left: {{ x }}; top: {{ y }}; z-index: {{ z }}; -webkit-transform: rotate({{ angle }}deg); -moz-transform: rotate({{ angle }}deg); transform: rotate({{ angle }}deg);"> style="{% if custpos %}position:absolute;{% endif %}left: {{ x }}; top: {{ y }}; z-index: {{ z }}; -webkit-transform: rotate({{ angle }}deg); -moz-transform: rotate({{ angle }}deg); transform: rotate({{ angle }}deg);">
{% if caption %} {% if caption %}
<img class="lazy" src="" data-original="{{ image.generate_thumbnail("x450") }}" alt="{{ caption }}"> <img class="lazy" src="" data-original="{{ image.generate_thumbnail("x450") }}" alt="{{ caption }}">
<h5 class="polaroid__title">{{ caption }}</h5> <h5 class="polaroid__title">{{ caption }}</h5>
@ -41,8 +49,9 @@
<img class="lazy" src="" data-original="{{ image.generate_thumbnail("x450") }}" alt="unnamed image"> <img class="lazy" src="" data-original="{{ image.generate_thumbnail("x450") }}" alt="unnamed image">
{% endif %} {% endif %}
</a> </a>
</div>
{% endfor %} {% endfor %}
</div>
</section>
{% if section.background %} {% if section.background %}
</div> </div>
{% endif %} {% endif %}