小编jum*_*art的帖子

使用SOFT-KEYBOARD与自举模式对焦

当自动聚焦场时,如何使软键盘提供自举模式? 这听起来很容易,但我还是无法做到.

焦点部分可以工作,但不是键盘.

我试图保存用户点击.

我可以利用'shown.bs.modal'并设置焦点,但软键盘不会自动显示.用户仍然需要重新占用该字段.如何强制软键盘出现.

我正在玩的代码(非常):

        this.$container.on('shown.bs.modal', function () {
            console.log('shown.bs.modal');
            setTimeout(function () {
                var $ctrl = $(jqselector);
                $ctrl.addClass('active').focus();
            }, 500);
        });
        this.$container.modal({
            backdrop: (this.config.showModal ? 'static' : true)
        })
        .on('hidden.bs.modal', function () {
            $(this).remove();
        });
Run Code Online (Sandbox Code Playgroud)

SE问题只关注焦点

另一个问题

编辑:稍微查看一下bootstrap代码后,看起来广告在所有处理后都会关注模态控件.我假设这样的事情正在发生,这就是为什么我添加了setTimeout,但即使有很大的延迟,也没有运气.我将在本周末更仔细地研究一下bootsrap代码


赏金编辑:Bootstrap代码:

  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })

    this.$element.trigger(e)

    if (this.isShown || e.isDefaultPrevented()) return

    this.isShown = true

    this.checkScrollbar()
    this.$body.addClass('modal-open')

    this.setScrollbar()
    this.escape()

    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

    this.backdrop(function () {
      var transition = …
Run Code Online (Sandbox Code Playgroud)

javascript mobile soft-keyboard twitter-bootstrap

5
推荐指数
1
解决办法
1489
查看次数