使用Javascript隐藏具有淡出效果的Bootstrap模态 [英] Hide Bootstrap modal with fade out effect using Javascript

查看:48
本文介绍了使用Javascript隐藏具有淡出效果的Bootstrap模态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本的引导程序模式可以登录,当我点击提交"时,它不会自行关闭.我使用这个简单的jquery

I have a basic bootstrap modal to log in, which doesn't close itself when I hit submit. I solved it using this simple jquery:

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

但是我也希望使用引导程序的衰落类正确地淡出模态-目前还没有发生,它会立即被隐藏.

But I also want the modal to fade out properly using bootstrap's fade class - which currently doesn't happen, it instantly gets hidden.

我该怎么做?

推荐答案

$('#myModal').delay(1000).fadeOut(450);

 setTimeout(function(){
    $('#myModal').modal("hide");
 }, 1500);

这篇关于使用Javascript隐藏具有淡出效果的Bootstrap模态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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