css – 更改Bootstrap模态效果

前端之家收集整理的这篇文章主要介绍了css – 更改Bootstrap模态效果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我发现这个 Demo

该演示有一个非常好的效果,我想知道是否有任何人有办法应用这个演示易于使用bootstrap Modal
特别是第一个(淡入和缩放)

解决方法

如果你看一下与模态窗口一起使用的bootstraps fade类,你会发现它所做的就是将不透明度值设置为0并为不透明度规则添加一个过渡。

无论何时启动模态,都会添加类,并将不透明度更改为值1。

知道你可以轻松地建立自己的淡入淡出类。

这是一个例子。

@H_403_15@@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"); .fade-scale { transform: scale(0); opacity: 0; -webkit-transition: all .25s linear; -o-transition: all .25s linear; transition: all .25s linear; } .fade-scale.in { opacity: 1; transform: scale(1); } @H_403_15@<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <!-- Button trigger modal --> <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal </button> <!-- Modal --> <div class="modal fade-scale" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel">Modal title</h4> </div> <div class="modal-body"> ... </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> </div> </div>

– 更新 –

这个答案最近得到了更多的投票,所以我想我添加一个更新,以显示在伟大的Animate.css库的帮助下自定义BS模式进出动画是多么容易
丹尼尔伊登。

所有需要做的就是将样式表包含在< head>< / head>中。部分。现在您只需要将动画类和库中的一个入口类添加到模态元素中。

@H_403_15@<div class="modal animated fadeIn" id="myModal" tabindex="-1" role="dialog" ...> ... </div>

但是还有一种方法可以将动画添加到模态窗口中,因为库中有一堆很酷的动画可以使元素消失,为什么不使用它们。

猜你在找的CSS相关文章