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.
This fixed position div can be achieved in just 2 lines of code which moves the div on scroll to the bottom of the page.
window.onscroll = function() {
document.getElementById('fixedDiv').style.top =
(window.pageYOffset + window.innerHeight - 25) + 'px';
};