I created a wrapper with an animation similar to the one on Apple's Airpods Pro page. It features a video that plays gradually as I scroll, with the text smoothly scrolling over it within a specific area (text-display).
So far, this part is working well. Now, my goal is to transition the position of the video-effect-wrapper from fixed to relative once the user reaches the end of the video and the animation completes. This way, the website will continue to scroll its content normally after the video animation.
This is what I have attempted:
//If video-animation ended: Make position of video-wrapper relative to continue scrolling
if ($(window).scrollTop() >= $("#video-effect-wrapper").height()) {
$(video).css("position", "relative");
$("#video-effect-wrapper .text").css("display", "none");
}
While this somewhat works, it lacks smoothness and does not account for reverse scrolling on the webpage.
Challenges I faced in addressing this issue:
- The need for natural and smooth scrolling and transitioning from fixed to relative positions
- The structure of the wrapper with non-fixed .text elements overlapping the fixed video element, complicating the solution