在引导模态不起作用时发出警报 [英] alertify upon a bootstrap modal not working

查看:89
本文介绍了在引导模态不起作用时发出警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有打开提示"按钮的模式:

I have a modal with a button 'open prompt':

<div class="modal fade" id="test" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Arquivo</h4>
            </div>
            <div class="modal-body">
                <a href="javascript:my_prompt();" class="button">Open prompt</a>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Save changes</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

还有my_prompt函数:

And the my_prompt function:

function my_prompt()
{
    alertify.prompt( 'Prompt', function (e, str) {}, "" );
}

当我用$('#test').modal('show');显示模态并单击以打开提示时,它们都会出现,但是无法编辑alertify.如果我按ESC键,它们都会消失.

When I show the modal with $('#test').modal('show'); and click to open the prompt, they both appears, but the alertify can not be edited. And if I press ESC key, they both disappear.

有人也有这个问题吗?有解决办法吗?

Anybody had this problem too? Is there a solution?

推荐答案

问题与模态div中tabindex="-1"的存在有关.

The issue is related to the presence of tabindex="-1" in your modal div.

通过删除它可以很好地工作,我正在寻找副作用,但是现在我发现了任何问题.

By removing it will work fine, I'm searching for side effects, but for now I have found any issue.

演示: http://jsfiddle.net/IrvinDominin/PC7k4/2/

这篇关于在引导模态不起作用时发出警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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