I’m using iScroll 4 for my rather heavy iPhone web/Phonegap app and trying to find a way to switch between iScrolls scrolling functionality and standard “native” webview scrolling, basically on click. Why I want this is described below.
My app has several different subpages all in one file. Some subpages have input fields, some don’t. As we all know, iScroll + input fields = you’re out of luck.
I’ve wrapped iScrolls wrapper div (and all its functionality) around the one sub page where scrolling is crucial, and where there are no input fields. The other sections, I’ve simply placed outside this div, which gives these no scrolling functionality at all. I’ve of course tried wrapping all inside the wrapper and enabling/disabling iScroll (shown below) but that didn’t work me at all:
myScroll.disable()
myScroll.enable()
By placing some sub pages outside the main scrolling area / iScroll div, I’ve disabled both iScrolls and the standard webview scrolling (the latter – which i guess iScroll does) which leaves me with no scrolling at all.
I was, however, able to get some vertical movability (is that even a word?) by adding the lines below. Unfortunately, that leaves me with only basic scrolling functionality, hence no more scrolling than your finger manages to swipe vertically on the screen. Terrible way to browse through large quantities of content
document.removeEventListener('touchmove', preventDefault, false);
document.removeEventListener('touchmove', preventDefault, true);
Therefore, I’m searching for a way to enable standard webview scrolling on the sub pages placed outside of iScroll’s wrapper div. I’ve tried different approaches such as the ones mentioned above but with no success. Sorry for not providing you guys with any hard code or demos to test out for yourselves, it’s simply too much code and it would be presented so out of its context it wouldn’t be of any use to anybody.
So, is there a way n javascript to do this, switching between iScroll scrolling functionality and standard “native” webview scrolling? I would rather not rebuild the entire DOM so a solution like the one described above would be preferable.
I never got this to work so I assume it cannot (easily) be done. I ended up including four different iscroll wrappers into my app which works but not what I was looking for. I’ll make this as the right answer for the time being.