Fix weird nth-child global CSS compilation by using a conditional class
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-23 10:52:26 +02:00
parent 206d248948
commit 2f46a4555e
2 changed files with 4 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
const nameSplit = name.split(', ') const nameSplit = name.split(', ')
// Photo index // Photo index
const odd = index % 2 === 1
const photoIndex = (index < 10 ? '0': '') + index const photoIndex = (index < 10 ? '0': '') + index
@@ -32,11 +33,11 @@
}) })
</script> </script>
<div class="photo" role="figure" aria-labelledby="photo-{index + 1}" bind:this={scope}> <div class="photo" class:photo--odd={odd} role="figure" aria-labelledby="photo-{index + 1}" bind:this={scope}>
<div class="photo__location wrap"> <div class="photo__location wrap">
<div class="wrapper"> <div class="wrapper">
<h2 class="title-location" id="photo-{index + 1}"> <h2 class="title-location" id="photo-{index + 1}">
{#each nameSplit as line, i} {#each nameSplit as _, i}
<span class="line"> <span class="line">
<span> <span>
{nameSplit[i]}{#if i < nameSplit.length - 1},{/if} {nameSplit[i]}{#if i < nameSplit.length - 1},{/if}

View File

@@ -194,7 +194,7 @@
} }
// Every second (on column 2) // Every second (on column 2)
&:nth-child(2n+2) { &--odd {
@include breakpoint (md) { @include breakpoint (md) {
transform: translateY(-64px); transform: translateY(-64px);
} }