I am currently creating a personal website and I want a full height header when the website is loaded. This header should animate its height when the user scrolls down and the content below the header should move synchronously to the animation of the header. And the header should be fixed positioned at the end. I got everything working, beside the fixed position. It is flickering when the animation is finished.
I created a fiddle, so you will understand what I mean more easy.
http://jsfiddle.net/30j5njrw/10/`
Thanks in advance for any help
Regards
Edit: I tried several things so far, like adding position fixed from the beginning to the header, or trying to position the header content via jQuery on scroll...but I never got the result I wish.
Edit2: If someone knows a site with a similar effect, please share it.
Edit3: Since no one got my problem so far, i will try to describe it more detailed.
I have a header and a content area. The header is set to full height of the viewport when the page loads. The header uses static css positioning at this point, so the content area is correctly positioned below the header outside of the viewport.
If I scroll down, the header shrinks and some css of the header content is animated. The content area now must move up with the arrow under the header and the header should be fixed when the animation is finished.
All your examples so far just don't care about the flow of the content below the header.
Edit4:
haxxxton answered the question and the solution looks even better than I actually wanted it. So I will reward him with the bounty when the 24 hours are over.
Edit5
Actually haxxxtons answer didn't fix my problem. I was so amazed that I have overseen some problems. The arrow must be part of the content section, since there will be more content sections below on the final site. I came up with another solution, but I got stuck either. Now I don't think that this is even possible to do. Here is an updated version of my fiddle:
http://jsfiddle.net/30j5njrw/14/
The arrow is still not moving properly since I can't do preventDefault() on the scroll event. I need to do preventDefault() during the scroll event when the height of the header is not 165px. According to different sources found on google, it is not possible to do preventDefault() on the scroll event. I might try now to play with padding of content area during the scroll event to make it look like it's not scrolling. But I don't think that the effect i want is actually possible.
Edit6:
It works to set the padding of the content area to the pixels of the scroll offset. See new fiddle:
But there is still a problem. When you scroll really fast it is flickering somehow and positioning of the footer is strange. But I don't know if you can scroll that fast with any other input device than the magic touchpads of MacBooks so I might ignore this problem, if I don't finde a solution in a few hours.