68
loading...
This website collects cookies to deliver better user experience
position: fixed
, and put the correct z-index
so that our foreground layer is on top.<Plx />
component and provide required transitions with parallxData
scrollTop
is 0
. Stop the animation when a user scrolls down to 700px
. During this time, let's scale our layer from 1
to 1.6
respectively to the current scroll position.<Plx parallaxData={[
{
start: 0,
end: 700,
properties: [
{
startValue: 1,
endValue: 1.6,
property: "scale"
}
]
}
]}>
<img src="foreground.jpg" />
</Plx>
800px
. Let's also scale it, but much less than the foreground layer. It will help to achieve this beautiful parallax effect between foreground and background layers.<Plx parallaxData={[
{
start: 0,
end: 800,
properties: [
{
startValue: 1,
endValue: 1.18,
property: "scale"
}
]
}
]}>
<img src="background.jpg" />
</Plx>
0
to 400px
and change the opacity
from 1
to 0
to make it disappear.<Plx parallaxData={[
{
start: 0,
end: 400,
properties: [
{
startValue: 1,
endValue: 0,
property: "opacity"
}
]
}
]}>
<img src="title.png" />
</Plx>