Quote:
Originally Posted by V42
I just got a rejection email for this reason. In case it helps anyone else, I figured out a solution that works for my needs. This solution is based on the javascript approach described earlier in this thread by MrMidi. The difference is that it disables scrolling/rubberbanding only when the content can fit entirely within the web view. If the content is larger than will fit, scrolling & rubberbanding are allowed.
Code:
<html>
<head>
<script>
document.ontouchmove = function(event) {
if (document.body.scrollHeight == document.body.clientHeight) event.preventDefault();
}
</script>
</head>
<body>
<p>No scrolling for you!</p>
</body>
</html>
|
I ran into a small problem with this approach. Apparently, there is a difference in behavior with regards to the clientHeight attribute in different versions of the iPhone OS. The above code works fine in v3.0, but not in v2.2.1. For some reason, in v2.2.1, the clientHeight is always equal to the scrollHeight, so the code would prevent scrolling in all cases. I was able to fix this by using window.innerHeight instead of document.body.clientHeight.