Selectively scrolling in iOS Safari?

Special forum to share and discuss skins for Pano2VR and Object2VR
Post Reply
ffurger
Posts: 105
Joined: Mon Mar 24, 2014 11:45 am

Hi there:

I noticed that if one allows for scrolling in a text box, in iOS this behaviour extends to the entire viewport. In other words, when scrolling in a text box you may end up bouncing the viewport - not my idea of a web app.

Now, there is an easy way to prevent iOS Safari from bouncing:

Code: Select all

document.ontouchmove = function(event){
    event.preventDefault();
}
It works like a charm, but has a major drawback: it blocks ALL divs from scrolling, including those that should scroll.

There is an alternative: one could prevent an ontouchmove event from "bubbling up" from those divs that are supposed to scroll:

Code: Select all

elementYouWantToScroll.ontouchmove = function(e) {
    e.stopPropagation();
};
Problem is I wasn't able to find the appropriate div in the skin. Has anyone been able to address this issue?

-Franco
Post Reply