PhoneGap - preventing Scroll on All Elements Except..

I am putting together a PhoneGap app from a web app, and on iOS I need to prevent all scrolling except for a few elements.  Following this stackoverflow post, it can be done by putting something like this in the query onReady callback, where "idToIgnore" is the id of the element you want to be scrollable:

var ignoreTouchMoveListener = function (e) {
    var el =;
    do {
        if ( === "idToIgnore")  {
    } while (el = el.parentNode);
document.body.addEventListener("touchmove", ignoreTouchMoveListener, false);

Coupled with setting UIWebViewBounce to false, the page seems to stay stays solidly fixed, with just the appropriate dynamic lists being scrollable.

Popular Posts