有没有办法让“脉动”模态背景从50%红色变为100%红色并回到50%红色和无限循环?
<a title="Sobre" data-placement="bottom" data-toggle="modal" href="#Sobre" class="btn btn-primary"> <i class="fa fa-quote-left"></i> </a>
<div class="modal bs-modal-lg" id="Sobre" tabindex="-1" role="dialog" aria-labelledby="SobreLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header alert-danger">
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-warning"></i>Danger</h4>
</div>
<div class="modal-body" style="padding-top: 15px; padding-bottom: 25px;">
<h2>Danger!</h2>
</div>
<div class="modal-footer">
<a class="btn btn-default" data-dismiss="modal">Close</a>
</div>
</div>
</div>
</div>
Bootstrap在类中有2个构建:
.modal-backdrop.fade {
filter: alpha(opacity=0);
opacity: 0;
}
.modal-backdrop.in {
filter: alpha(opacity=50);
opacity: .5;
}
例如,是否可以在两个时间间隔2秒之间交替?
由于
答案 0 :(得分:2)
您应该使用css animations。这只是您可以做的一个示例,但您应该使用animation
属性具有的不同子属性。
.modal-backdrop {
background-color: red;
animation: warn 2s infinite alternate;
-webkit-animation: warn 2s infinite alternate;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes warn {
from {opacity: 0;}
to {opacity: 0.5;}
}
@keyframes warn {
from {opacity: 0;}
to {opacity: 0.5;}
}