В моем коде анимация срабатывает, но проблема в том, что она срабатывает в момент когда кнопка активная, то есть доли секунды и анимация какая-то каличная что ли))). Подскажите скриптик, чтобы анимация происходила после нажатия кнопки полностью
<!DOCTYPE html>
<html lang="ru-UA">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Заголовок</title>
<!-- Bootstrap -->
<link href="css/stylesheet.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav>
<form id="my_form" class="navbar-form navbar-left" role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Поиск">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</nav>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.js"></script>
<script>
$("#my_form").submit(function(event){
event.preventDefault(); //отменяем отправку
setTimeout(function(){$("#my_form").submit();}, 500); //отправляем через 3000 ms
setTimeout(function () {window.location.reload();}, 500);
});
</script>
</body>
</html>
.btn {
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 16px;
font-size: 13px;
line-height: 1.846;
border-radius: 3px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: thin dotted;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn:hover,
.btn:focus,
.btn.focus {
color: #444444;
text-decoration: none;
}
.btn:active,
.btn.active {
outline: 0;
background-image: none;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn-default {
color: #444444;
background-color: #ffffff;
border-color: transparent;
}
.btn-default:focus,
.btn-default.focus {
color: #444444;
background-color: #e6e6e6;
border-color: rgba(0, 0, 0, 0);
outline: 0
}
.btn-default:hover {
color: #444444;
background-color: #e6e6e6;
border-color: rgba(0, 0, 0, 0);
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
color: #444444;
background-color: #e6e6e6;
border-color: rgba(0, 0, 0, 0);
}
.btn-default:active:hover,
.btn-default.active:hover,
.open > .dropdown-toggle.btn-default:hover,
.btn-default:active:focus,
.btn-default.active:focus,
.open > .dropdown-toggle.btn-default:focus,
.btn-default:active.focus,
.btn-default.active.focus,
.open > .dropdown-toggle.btn-default.focus {
color: #444444;
background-color: #d4d4d4;
border-color: rgba(0, 0, 0, 0);
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
background-image: none;
}
.btn-default .badge {
color: #ffffff;
background-color: #444444;
}
.btn-default {
position: relative;
overflow: hidden;
z-index: 0;
}
.btn-default:after {
content: "";
position:absolute;
width: 200%;
height: 200%;
top: -50%;
left: -50%;
z-index: -1;
opacity: 0;
background-color: #e0e0e0;
background-image: -webkit-radial-gradient(circle, #e0e0e0 10%, #ffffff 11%);
background-image: -o-radial-gradient(circle, #e0e0e0 10%, #ffffff 11%);
background-image: radial-gradient(circle, #e0e0e0 10%, #ffffff 11%);
background-repeat: no-repeat;
}
.btn-default:focus {
background-color: #ffffff;
}
.btn-default:hover,
.btn-default:active:hover {
background-color: #f0f0f0;
outline: 0;
}
.btn-default:active {
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
}
.btn-default:active:after {
-webkit-animation: ripple 0.4s forwards;
-moz-animation: ripple 0.4s forwards;
-o-animation: ripple 0.4s forwards;
animation: ripple 0.4s forwards;
}
@-webkit-keyframes ripple {
0% { -webkit-transform: scale(1); opacity: 1; }
50% { opacity: 1; }
100%{ -webkit-transform: scale(4.8); opacity: 1; }
}
@-moz-keyframes ripple {
0% { -moz-transform: scale(1); opacity: 1; }
50% { opacity: 1; }
100% { -moz-transform: scale(4.8); opacity: 1; }
}
@-o-keyframes ripple {
0% { -o-transform: scale(1); opacity: 1; }
50% { opacity: 1; }
100% { -o-transform: scale(4.8); opacity: 1; }
}
@keyframes ripple {
0% { -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); transform: scale(1); opacity: 1; }
50% { opacity: 1; }
100% { -webkit-transform: scale(4.8); -moz-transform: scale(4.8); -ms-transform: scale(4.8); transform: scale(4.8); opacity: 1; };
}
.btn {
text-transform: uppercase;
border: none;
-webkit-box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.4);
}