IOS web application disable scroll offset

How to disable offset scrolling for my webapp?

I mean the dark gray area http://i.stack.imgur.com/a3Rt4.png

Disable scrolling in iPhone web application? I tried this, but it did not work all the time, it only works sometimes, then it suddenly stops, and I can scroll again.

+4
source share
4 answers
document.body.addEventListener('touchmove', function(e){ e.preventDefault(); }); 

works, but make sure the body has 100% screen height.

+12
source

This completely disables all touch events.

 <script type="text/javascript"> function blockMove() { event.preventDefault() ; } </script> <body ontouchmove="blockMove()"> 

It freezes your screen in place, giving it a more natural feel. But also disables any scrollable areas. If you want to keep your scrollable areas and still remove the rubber band effect from above and below, see here: http://cubiq.org/iscroll .

+3
source

The bottom line is that there are several ways to do this, but none of them are documented. All of them currently rely on searching through subviews of your UIWebView and changing their properties. All of these subtasks are undocumented, so your results may vary. This, of course, is not an ideal way to do something, and, as you have learned, the results can be different. If you can get the scroll view contained in the web view (again, undocumented), you can turn off the scroll / bounce offset - this link may be useful:

http://blog.andrewpaulsimmons.com/2010/02/controlling-uiscrollview-in-uiwebview.html

iOS 5 has an official fix for this, but you will need to ask at devforums.apple.com or read the new documentation, because everything related to iOS 5 is still not disclosed and cannot really be discussed here.

0
source

I wrote this solution to allow scrollable areas, but not allowing the body to scroll when they are visible.

fooobar.com/questions/62783 / ...

0
source

All Articles