SyntaxFix
Write A Post
Hire A Developer
Questions
This is an old thread but CSS3 has a solution.
position: sticky;
Have a look at this blog post.
Demonstration:
And this documentation.