I have a fixed navigation bar on my bootstrap webpage. But once I animate the body element of my page the navigation bar scrolls with the page out of view.
I animate the body to 'fly in' from the right. This is done via this css:
@keyframes body-anim {
0% {
transform: translate(10rem);
opacity: 0;
}
25% {
opacity: 0;
}
}
body {
animation-name: body-anim;
animation-duration: 2s;
animation-fill-mode: forwards;
animation-timing-function: ease-in-out;
overflow-x: hidden;
}
This animation breaks my fixed-top-navigation bar which looks like this:
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"><span class="col-brand">B</span>rand</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#">Example</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
Have any idea why?
JSFiddle: https://jsfiddle.net/DTcHh/20315/