Is it possible to position an element fixed relative to the viewport in Mobile Safari? As many have noted, position: fixed doesn’t work, but Gmail just came out with a solution that almost is what I want – see the floating menu bar on the message view.
Getting real-time scroll events in JavaScript would also be a reasonable solution.
iOS 5 has support for position:fixed.