Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在iOS safari中将iScroll与输入一起使用时,键盘会将滚动条推到视口上方并卡住_Javascript_Ios_Mobile Safari_Iscroll - Fatal编程技术网

Javascript 在iOS safari中将iScroll与输入一起使用时,键盘会将滚动条推到视口上方并卡住

Javascript 在iOS safari中将iScroll与输入一起使用时,键盘会将滚动条推到视口上方并卡住,javascript,ios,mobile-safari,iscroll,Javascript,Ios,Mobile Safari,Iscroll,有人知道怎么解决这个问题吗?我和Cubiq的Matteo谈过,他的解决方案是使用转换而不是转换。现在,当键盘出现时,我基本上会在页面下方添加键盘大小的填充,但是围绕光标的一系列新问题被搞乱了: $('body').on('focus', 'input, textarea', function() { console.log('SCROLLER INPUT FOCUS'); if(!self.getCurrentScroller())

有人知道怎么解决这个问题吗?我和Cubiq的Matteo谈过,他的解决方案是使用转换而不是转换。现在,当键盘出现时,我基本上会在页面下方添加键盘大小的填充,但是围绕光标的一系列新问题被搞乱了:

$('body').on('focus', 'input, textarea', function() {
                console.log('SCROLLER INPUT FOCUS');
                if(!self.getCurrentScroller()) return;
                self.getCurrentScroller().css('padding-bottom', 260);
                self.getCurrentIscroll().refresh();
                self.getCurrentIscroll().scrollToElement(this, 0);
            });

            $('body').on('blur', 'input, textarea', function() {
                console.log('SCROLLER INPUT BLUR');
                if(!self.getCurrentScroller()) return;
                self.getCurrentScroller().css('padding-bottom', 0);
                self.getCurrentIscroll().refresh();
                self.getCurrentIscroll().scrollToElement(this, 0);
            });

这个想法是,如果你在iScroll的底部,键盘只会导致iScroll卡在视口上方,并且当键盘向上推时,没有更多的页面可以滚动

有时虚拟键盘会导致物理磁盘更改。这样,当键盘隐藏时,您可以将其滚动到顶部

$wrapper.find('input, textarea').on('blur', function (e) {
    $wrapper.scrollTop(0);
});