Force 3/2 format for non landscape photos on Location page

Center image on a background when square, portrait or other ratio
- Fix MutuationObserver for using components (would think a component is an item)
This commit is contained in:
2022-06-13 18:28:24 +02:00
parent b649187365
commit 615f7df4a1
5 changed files with 58 additions and 22 deletions

View File

@@ -81,7 +81,6 @@
position: relative;
z-index: 3;
border-radius: 0;
background: $color-primary;
@include bp (sm) {
border-radius: 8px;
@@ -97,6 +96,38 @@
will-change: transform;
}
// Variant: Not landscape
&.not-landscape {
aspect-ratio: 3 / 2;
@supports not (aspect-ratio: auto) {
position: relative;
overflow: hidden;
padding-top: 66.66%;
height: 0;
}
picture {
height: 100%;
background: $color-cream;
}
img {
height: 100%;
width: 100%;
object-fit: contain;
@supports not (aspect-ratio: auto) {
position: absolute;
top: 50%;
left: 50%;
width: auto;
max-width: 100%;
height: auto;
transform: translate(-50%, -50%);
}
}
}
// Scale down image on hover
@media (hover: hover) {
a:hover {