I am attempting to achieve a parallax effect without relying on background-image
or background-attachment: fixed
, as the latter doesn't function well on iOS. Below is my approach:
HTML
<article class="twentyseventeen-panel">
<div class="panel-image">
<div style="position: absolute; top: 0; bottom: 0; left: 0; right: 0;" >
<img src="<?php echo esc_url( $thumbnail[0] ); ?>" style="width: 100%;" />
</div>
</div>
</article>
CSS
.twentyseventeen-panel {
overflow: hidden;
position: relative;
}
.panel-image {
position: relative;
height: 100vh;
max-height: 200px;
}
I am currently facing a challenge with making the image scroll for the desired parallax effect. I have experimented with setting the image to a fixed
position, but it causes the image to disappear. What would be the correct approach to implement a parallax effect in this scenario?