Twitter bootstrap modal-backdrop 不会消失 [英] Twitter bootstrap modal-backdrop doesn't disappear

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

问题描述

我正在使用 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 bootstrap modal-backdrop 不会消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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