Photo: Fix number positioning and parallax effect
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -42,13 +42,15 @@ export const animateIn = scope => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Number parallax on scroll
|
// Number parallax on scroll
|
||||||
const numberParallax = ScrollOut({
|
const nbParallaxMedia = window.matchMedia('(min-width: 768px)')
|
||||||
targets: scope.querySelector('.photo__number'),
|
const nbParallax = nbParallaxMedia => {
|
||||||
|
if (nbParallaxMedia.matches) {
|
||||||
|
const scroll = ScrollOut({
|
||||||
|
targets: scope.querySelector('#photo_number'),
|
||||||
onShown (el) {
|
onShown (el) {
|
||||||
const translate = anime({
|
const translate = anime({
|
||||||
targets: el,
|
targets: el,
|
||||||
translateX: ['-50%', '-50%'],
|
translateY: (window.innerWidth <= 768) ? ['0%', '20%'] : ['-15%', '15%'],
|
||||||
translateY: ['-50%', '-20%'],
|
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
autoplay: false
|
autoplay: false
|
||||||
@@ -60,4 +62,10 @@ export const animateIn = scope => {
|
|||||||
window.removeEventListener('scroll', parallaxAnime)
|
window.removeEventListener('scroll', parallaxAnime)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen on screen size to run the function
|
||||||
|
nbParallaxMedia.addListener(nbParallax)
|
||||||
|
nbParallax(nbParallaxMedia)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
const imgAlt = `${photo.name}, ${location.region}, ${location.country.name}`
|
const imgAlt = `${photo.name}, ${location.region}, ${location.country.name}`
|
||||||
const photoHref = `/viewer/${location.country.slug}/${location.slug}/${photo.slug}`
|
const photoHref = `/viewer/${location.country.slug}/${location.slug}/${photo.slug}`
|
||||||
|
|
||||||
|
// Photo index
|
||||||
|
const photoIndex = (index < 10 ? '0': '') + index
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Run code when mounted
|
** Run code when mounted
|
||||||
@@ -69,9 +72,9 @@
|
|||||||
<time class="photo__date" datetime={formatDate(photo.date, 'DATETIME')}>
|
<time class="photo__date" datetime={formatDate(photo.date, 'DATETIME')}>
|
||||||
{formatDate(photo.date, 'FULL')}
|
{formatDate(photo.date, 'FULL')}
|
||||||
</time>
|
</time>
|
||||||
<span class="photo__number">
|
<div class="photo__number">
|
||||||
{(index < 10 ? '0': '') + index}
|
<span id="photo_number">{photoIndex}</span>
|
||||||
</span>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -140,15 +140,31 @@
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
|
||||||
|
span {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
font-size: pxVW(300);
|
|
||||||
left: 92%;
|
|
||||||
top: 50%;
|
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transform: translate(-50%, -50%);
|
top: 0;
|
||||||
|
right: 8%;
|
||||||
|
transform: translate(0, -25%);
|
||||||
|
font-size: pxVW(300);
|
||||||
|
}
|
||||||
|
@include breakpoint (md) {
|
||||||
|
top: 50%;
|
||||||
|
right: 0;
|
||||||
|
bottom: auto;
|
||||||
|
transform: translate(26.5vw, -50%);
|
||||||
|
width: 50%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
@include breakpoint (lg) {
|
||||||
|
transform: translate(28vw, -50%);
|
||||||
}
|
}
|
||||||
@include breakpoint (xxl) {
|
@include breakpoint (xxl) {
|
||||||
font-size: rem(300px);
|
font-size: rem(300px);
|
||||||
|
transform: translate(70%, -50%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
margin-bottom: 88px;
|
margin-bottom: 88px;
|
||||||
overflow-x: hidden;
|
|
||||||
|
|
||||||
@include breakpoint (sm) {
|
@include breakpoint (sm) {
|
||||||
margin-bottom: 120px;
|
margin-bottom: 120px;
|
||||||
@@ -67,6 +66,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** List view
|
** List view
|
||||||
*/
|
*/
|
||||||
@@ -79,9 +79,9 @@
|
|||||||
|
|
||||||
// Photo
|
// Photo
|
||||||
.photo {
|
.photo {
|
||||||
@include breakpoint (sm) {
|
|
||||||
// Even photos
|
// Even photos
|
||||||
&:nth-child(even) {
|
&:nth-child(even) {
|
||||||
|
@include breakpoint (sm) {
|
||||||
// Location
|
// Location
|
||||||
.photo__location, h2 {
|
.photo__location, h2 {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -96,12 +96,26 @@
|
|||||||
right: 100%;
|
right: 100%;
|
||||||
left: -30px;
|
left: -30px;
|
||||||
}
|
}
|
||||||
&__number {
|
|
||||||
right: 77%;
|
|
||||||
left: auto;
|
|
||||||
text-align: right;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Number
|
||||||
|
.photo__number {
|
||||||
|
@include breakpoint (sm) {
|
||||||
|
right: auto;
|
||||||
|
left: 8%;
|
||||||
|
}
|
||||||
|
@include breakpoint (md) {
|
||||||
|
right: auto;
|
||||||
|
left: 0;
|
||||||
|
transform: translate(-23vw, -50%);
|
||||||
|
}
|
||||||
|
@include breakpoint (lg) {
|
||||||
|
transform: translate(-26vw, -50%);
|
||||||
|
}
|
||||||
|
@include breakpoint (xl) {
|
||||||
|
transform: translate(-66%, -50%);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,6 +145,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Grid view
|
** Grid view
|
||||||
*/
|
*/
|
||||||
@@ -205,6 +220,7 @@
|
|||||||
transform: none;
|
transform: none;
|
||||||
top: auto;
|
top: auto;
|
||||||
left: auto;
|
left: auto;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
&__date {
|
&__date {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
Reference in New Issue
Block a user