繁体   English   中英

在将文本输入到输入元素后,防止华为手机的jquery-mobile popup重新定位

[英]Prevent jquery-mobile popup repositions for Huawei phones after text is entered to an input element

在我们的项目中,我们正在使用jquery-mobile弹出对话框

一旦显示对话框,我第一次尝试填写手机上的文本(华为P9 lite,Android 6.0.0,Chrome 55.0.2883.91)时,弹出窗口将关闭并重新打开。

即使在演示表单弹出窗口中,我也可以复制此问题。

在一个更大的设备(5.7英寸对5英寸)与更大的屏幕和几乎相同的Android(6.0.1,相同的浏览器)这不会发生。

它似乎是由弹出键盘出现后自动重新定位引起的。 有没有人遇到类似的问题? 你是怎么解决的?

<a href="#popupLogin" data-rel="popup" data-position-to="window" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-check ui-btn-icon-left ui-btn-a" data-transition="pop">Sign in</a>
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
    <form>
        <div style="padding:10px 20px;">
            <h3>Please sign in</h3>
            <label for="un" class="ui-hidden-accessible">Username:</label>
            <input type="text" name="user" id="un" value="" placeholder="username" data-theme="a">
            <label for="pw" class="ui-hidden-accessible">Password:</label>
            <input type="password" name="pass" id="pw" value="" placeholder="password" data-theme="a">
            <button type="submit" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">Sign in</button>
        </div>
    </form>
</div>

答案是基于奥马尔的评论。 一旦我评论下面的代码行,就不会出现这种行为(可能会丢失一个很好的重新定位功能)。

_handleWindowResize: function(/* theEvent */) {
    if ( this._isOpen && this._ignoreResizeTo === 0 ) {
        if ( ( this._expectResizeEvent() || this._orientationchangeInProgress ) &&
            !this._ui.container.hasClass( "ui-popup-hidden" ) ) {
            // effectively rapid-close the popup while leaving the screen intact
            // this._ui.container
            //  .addClass( "ui-popup-hidden ui-popup-truncate" )
            //  .removeAttr( "style" );
        }
    }
},

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM