Twitter引导模态背景不会消失 [英] Twitter bootstrap modal-backdrop doesn't disappear

查看:77
本文介绍了Twitter引导模态背景不会消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter引导模式对话框.当我单击引导模式对话框的提交按钮时,它将发送一个AJAX请求.我的问题是模态背景不会消失. 模态"对话框确实可以正确消失,但是保留了模态背景",在屏幕上创建了不透明性

I am using the Twitter bootstrap Modal dialog. When I click on the submit button of the bootstrap modal dialog, it sends an AJAX request. My problem is that the modal-backdrop doesn't disappear. The Modal dialog does disappear correctly, but instead "modal-backdrop in" that creates the opacity on the screen remain

我该怎么办?

推荐答案

在执行AJAX请求时,请确保不替换包含实际模态窗口的容器,因为Bootstrap将无法找到引用当您尝试将其关闭时.在您的Ajax完整处理程序中,删除模态,然后替换数据.

Make sure you're not replacing the container containing the actual modal window when you're doing the AJAX request, because Bootstrap will not be able to find a reference to it when you try to close it. In your Ajax complete handler remove the modal and then replace the data.

如果这不起作用,您可以通过执行以下操作来强制其消失:

If that doesn't work you can always force it to go away by doing the following:

$('#your-modal-id').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').remove();

这篇关于Twitter引导模态背景不会消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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