Prevent unwanted scrolling in iOS

edited February 2012 in Packaging Apps
When testing my apps on iOS using Phonegap i noticed that in some parts of my app the webview would ignore drag and flick events on scrollers and scroll the entire document body instead. I am not sure why this is happening in some cases but not in others but in the phonegap wiki I found a way to reliably prevent this.

You simply have to listen to the ontouchmove event of the document body and prevent the default behaviour. Just like this:

	<script type="text/javascript">
		touchMove = function(event) {
			// Prevent scrolling on this element
<body ontouchmove="touchMove(event);">
Hope this helps!
Sign In or Register to comment.