I am attempting to create a unique animation for a header div that involves moving it to the top of the screen when the user scrolls down. Once the header div reaches the top, I want it to stay fixed in that position. As the header div moves upwards, it will pass over a banner div. To enhance this transition, I have implemented a fading effect on the banner div based on the proximity of the header div to the top.
When the header div is fixed at the top and the banner div has completely faded out, I would like a reverse scroll action to trigger an animation that moves the header div back to its original position (margin-top: 400;) while simultaneously causing the banner div to fade back into view.
You can access my code on JSFiddle here: https://jsfiddle.net/xm33Laag/
check out the JSFiddle
Unfortunately, the functionality on the JSFiddle does not match that of my local version :S
While I can successfully move the header div to the top, I struggle to animate it back down. Additionally, I aspire for my animation to resemble the fluidity demonstrated in this example:
My preference is to refrain from using fullPage.js as I only require this specific function without the additional features it offers.
In the ideal example provided above, the animation initiates smoothly with a single scroll, lacking any initial jitters before the movement begins - a quality I truly admire!
Currently, my animation requires an initial scroll action to display 100px of abrupt movement before transitioning into the animated sequence. My aim is to seamlessly integrate these actions into one cohesive movement.
Thank you!