打开新模式时如何隐藏Bootstrap先前的模式? [英] How to hide Bootstrap previous modal when you opening new one?

查看:57
本文介绍了打开新模式时如何隐藏Bootstrap先前的模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了麻烦:我具有使用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模态:

You hide Bootstrap modals with:

$('#modal').modal('hide');

$().hide()使匹配的元素不可见,但就与模态相关的代码而言,它仍然存在.请参见模式文档中的方法"部分.

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先前的模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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