Scrolling <textarea> in iPhone

I am using phoneGap 1.1.0 and iScroll 4.1.9 to create an application for iPhone and Android.
The Android scroll text box works great.
But on the iPhone, the text box does not scroll.
Two-finger scrolling does not work on my iPhone 3GS (iOS 5.0.1)
Anyone have a solution?
thanks.

+4
source share
2 answers

The problem is that, as I think, you are trying to make and disable the "frame" of the application from scrolling on the screen with:

document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false); 

Unfortunately, I have tried every combination that I think, including a new property the CSS -webkit-overflow-scrolling: touch (to no avail). Have not found a solution yet.

0
source

I know this a bit later, but I found a solution:

This answer to this question prohibits scrolling of UIScrollView in UIWebView: Is scrolling allowed in UIWebView?

I added this code to the viewDidLoad function of MainViewController.m

 for (UIView *view in webview.subviews) { if ([view isKindOfClass:[UIScrollView class]]) { UIScrollView *scrollView = (UIScrollView *)view; scrollView.scrollEnabled = NO; } } 

The following problem does not allow iScroll to handle events in TextArea, for this you need to get the debug version of iscroll so that you can change the code (3rd line):

 handleEvent: function (e) { var that = this; if(e.srcElement.tagName == "TEXTAREA") return; // don't handle textarea switch(e.type) { case START_EV: if (!hasTouch && e.button !== 0) return; that._start(e); break; case MOVE_EV: that._move(e); break; case END_EV: case CANCEL_EV: that._end(e); break; case RESIZE_EV: that._resize(); break; case WHEEL_EV: that._wheel(e); break; case TRNEND_EV: that._transitionEnd(e); break; } } 

nor do you prevent Default for your text field using similar ifs.

This combination worked for me.

The -webkit and overflow css tags just make it more enjoyable.

Uh, but on ios 4, scrolling is done with two fingers, not one.

0
source

Source: https://habr.com/ru/post/1396166/


All Articles