I want to increase the duration of fading using bootstrap class fade.
I found a few solutions like:
Change amount of time Bootstrap tooltips display / fade in and out
How can I change the speed of the fade for alert messages in Twitter Bootstrap?
This is my full code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<style>
.fade {
opacity: 0;
-webkit-transition: opacity 40s linear;
-moz-transition: opacity 40s linear;
-ms-transition: opacity 40s linear;
-o-transition: opacity 40s linear;
transition: opacity 40s linear;
}
</style>
</head>
<body>
<div class="container">
<h2>Wells are sections with border and grey background</h2>
<div class="well">Basic Well</div>
<div class="well well-sm">Small Well</div>
<div class="alert alert-success">
Congratulations, you just won the game!
</div>
<!-- to make the alert closable -->
<div class="alert alert-info">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
Don't forget Kelly's birthday is today!
</div>
<!-- add the fade and in class to animate when closing -->
<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
Are you sure you want to delete your account?
</div>
</div>
</body>
</html>
And it just doesn’t work. What am I doing wrong?
2
Answers
This should solve your problem:
Also, more info about transition-duration: https://www.w3schools.com/CSSref/css3_pr_transition-duration.asp
Have you tried
!important
? So, it would look like this:You can set whatever for the transition duration!
It is currently set to
1 second
, but if you think it is too slow, try with300ms
Hope this helped