问题描述
我遇到了这样的麻烦:我有使用 Bootstrap 模态进行的身份验证.
I have such trouble: I have authentification which is made using Bootstrap modals.
当用户打开登录模式时,他可以去注册模式(或其他).所以,我需要关闭前一个.
When user opens sign in modal he can go to sign up modal ( or other ) . So, I need to close previous one.
现在我像这样关闭它们:
Now I'm closing them like this:
$(document).ready(function(){
$("a").click(function() {
$("#login").hide();
$("#sign_up").hide();
})
});
但是当我这样做时 - 在我刷新页面之前,我无法重新打开登录模式(点击从登录中注册后).
but when I'm doing this - I can't reopen sign in modal( after click on sign up from sign in) until I refresh the page.
有人可以建议如何检查我单击链接的模式并在调用另一个模式时关闭它?有没有通用的方法来关闭以前的模式?
推荐答案
你隐藏 Bootstrap modals 有:
You hide Bootstrap modals with:
$('#modal').modal('hide');
说 $().hide()
使匹配的元素不可见,但就 modal 相关的代码而言,它仍然存在.请参阅 Modals 文档中的方法部分.
Saying $().hide()
makes the matched element invisible, but as far as the modal-related code is concerned, it's still there. See the Methods section in the Modals documentation.
这篇关于打开新模式时如何隐藏 Bootstrap 以前的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!