Bootstrap模式还原按钮重点放在关闭上 [英] Bootstrap modal restores button focus on close

查看:87
本文介绍了Bootstrap模式还原按钮重点放在关闭上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正艰难地挣扎于一种效果,我认为Bootstrap想要这种效果,但我想逃脱。我有按钮:

I am in very difficult struggle with one effect, which I believe is wanted in Bootstrap, but I want to escape. I have button:

<a data-toggle="modal" data-target="#video" class="btn btn-primary btn-lg" href="#">Video<i class="pe-7s-angle-right pe-2x pe-va" style="line-height: 0.3;"></i></a>

哪个会打开带有某些视频的模态窗口:

Which opens modal window with some video:

<div class="modal fade video-lightbox in" id="video" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: block;"><div class="modal-backdrop fade in" style="height: 442px;"></div>

因此,当我关闭模式时,我的按钮会自动聚焦。在Bootstrap中是否需要这种效果,如何才能摆脱它?我不希望我的按钮在关闭模态后成为焦点。

So when I close the modal, my button gets in focus automatically. Is this effect wanted in Bootstrap and how can I escape it ? I don`t want my button to be in focus after closing the modal.

推荐答案

通过删除

d.trigger("focus")    


$ bootstrap.min.js中的b $ b

in bootstrap.min.js:

a.fn.modal = b, a.fn.modal.Constructor = c, a.fn.modal.noConflict = function() {
    return a.fn.modal = d, this
}, a(document).on("click.bs.modal.data-api", '[data-toggle="modal"]', function(c) {
    var d = a(this),
        e = d.attr("href"),
        f = a(d.attr("data-target") || e && e.replace(/.*(?=#[^\s]+$)/, "")),
        g = f.data("bs.modal") ? "toggle" : a.extend({
            remote: !/#/.test(e) && e
        }, f.data(), d.data());
    d.is("a") && c.preventDefault(), f.one("show.bs.modal", function(a) {
        a.isDefaultPrevented() || f.one("hidden.bs.modal", function() {
            d.is(":visible") && d.trigger("focus")
        })
    }), b.call(f, g, this)
})

这篇关于Bootstrap模式还原按钮重点放在关闭上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆