As it’s being discovered, position:fixed is not working in Safari for iPhone. Obviously, the desire to have a fixed toolbar at the top or bottom is going to almost a requirement for many web app developers.
So, the first thing that came to my mind was to manually keep positioned elements fixed via JavaScript. No luck here either! If you pull up http://www.quirksmode.org/viewport/experiments/scrolling2.html in your iPhone, you’ll note that neither of the following work:pageXOffset and pageYOffsetdocument.body.scrollTop and document.body.scrollLeftHas anyone found a work around?
Come on Apple, if you’re going to state that Safari for the iPhone is as powerful as the desktop version, please enable it to do basic CSS2 and JavaScript functions!
Update: I’ve found a workaround which uses an auto-scrolling div. The catch is, in order to scroll, you must use two-fingers, identical to the way you’re able to do with MacBook trackpads. This seems like a viable solution, however, there are several trade-offs:
One, the slick physics behind the iPhone scroll are no longer present, and two, there are obvious usability issues with this solution. For almost all webpages, the user is able to scroll using just one finger. How then, would they know that for certain pages, two fingers were necessary. Not a very desirable solution to me.
Check out our example here: http://www.launchpadhq.com/experiments/test1.html