As it turns out, you can easily get rid of the big toolbar at the top,
which is much larger than the one at the bottom. All you have to do
is position the content of your page at "top: 60px", and then when the
page loads call "window.scrollTo(0, 60)", which will scroll the big
toolbar right out of sight! This gives
This breaks down when the user rotates the phone, though, so you have
to call "window.scrollTo(0, 60)" again when you detect a change in the
screen size (I posted about how to do that earlier).
Here is a demo:
<body id='<%= @body_id %>' onload='alert("im
loaded");window.scrollTo(0, 1);'>
<div id="container">
<%= @content_for_layout %>
</div>
</body>
I get the alert, but the window will NOT scroll.
Using prototype.
So what is the best, absolutely minimal example that everyone can use
who wants to hide the scrollbar in their iPhone page?
-- Christopher Allen
On Jul 2, 3:23 pm, "Christopher Allen" <Christoph...@iPhoneWebDev.com>
wrote:
I guess ideally this should be inside some type of iPhone specific
user-agent test, so that non-iPhone windows are not scrolled. How can
we do that in the most minimal fashion?
-- Christopher Allen
if(navigator.userAgent.indexOf('iPhone') != -1) {
onload='setTimeout(function(){window.scrollTo(0, 1);}, 100);
}
Pretty minimal. Or you could do it server side and just not send that
JS if the browser isn't an iPhone.
-Ryan Doherty
On Jul 2, 3:07 pm, "Christopher Allen" <Christoph...@iPhoneWebDev.com>
wrote:
Despite several attempts I've been unable to capture the scroll's
offset, or a scroll event.
None of the following working... pageXOffset, pageYOffset,
document.body.scrollTop, document.body.scrollLeft
Ideas?