Finally working - separated fixed and flexi height parallaxing to pull it off
This commit is contained in:
@ -7,17 +7,19 @@ $parallax: 'parallax';
|
||||
right: 0;
|
||||
height: 100%;
|
||||
max-height: 60vh;
|
||||
z-index: -1;
|
||||
|
||||
&__image {
|
||||
@include animate(0.5s);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
left: -10px;
|
||||
bottom: -10px;
|
||||
right: -10px;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: 50% 30%;
|
||||
opacity: 0;
|
||||
transform: translateZ(-400px) scale(1.4);
|
||||
transform-origin: top center;
|
||||
}
|
||||
|
||||
&__overlay {
|
||||
@ -32,9 +34,20 @@ $parallax: 'parallax';
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&:not(&--boxed) {
|
||||
&--flexible-height {
|
||||
|
||||
/**
|
||||
* We need to apply the transform on the whole parallax. I think this is because
|
||||
* our 'frame' is the entire <main> element, rather than a fixed-height sub-element
|
||||
**/
|
||||
transform: translateZ(-400px) scale(1.4);
|
||||
transform-origin: top center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
&--fixed-height {
|
||||
.#{$parallax} {
|
||||
&__overlay {
|
||||
&__image {
|
||||
transform: translateZ(-400px) scale(1.4);
|
||||
transform-origin: top center;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user