I am creating an iPhone Web Application and you are now, since iOS5, able to use position: fixed; for headers etc. etc.
Although it works, if you scroll up at the top of a page, it displays the usual gray area for a while before you can't scroll anymore
Is there a way to stop this scrolling? I've tried things like overflow: hidden; but I can't seem to find anything.
P.S. I only want the one thing to stop scrolling, I have a div named #container which I still want to have the ability to scroll.
Question: Q: Right-hand Scroll Bar iPhone Is there any way to disable the right-hand scroll bar on the iPhone? Answer: A: Answer: A: There is no option to disable that feature.
After reviewing several solutions, I began to create a custom solution:
http://jaridmargolin.github.io/bouncefix.js/
bouncefix.add(el)
Apply fix so that the given element no longer causes a full body elastic bounce when scrolling at its extremes.
bouncefix.remove(el)
Remove all listeners/observers responsible for fixing the full body elastic bounce.
Scrollfix was a good start, however I noticed several problems:
It uses a similar approach to that of scrollfix. The problem occurs when you are at one of the scrolling extremes. On touchstart, we look to see if we are at the top extreme or bottom extreme, adding 1px if we are at the top, and removing 1px if we are at the bottom.
Unfortunately, this trick only works if we are able to set the scrollTop value. If the content is not yet scrollable, for example, you only have 1 list item, the whole body will again scroll. Bouncefix.js will take care of all of this behind the scenes by using event delegation and checking the scrollHeight against the offsetHeight anytime touchstart is triggered. In the case that there is no scrollable content, all scrolling on the container is blocked with e.preventDefault();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With