Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Mrllee1/37329fcdbe054e40623a91997b3899e6 to your computer and use it in GitHub Desktop.
Save Mrllee1/37329fcdbe054e40623a91997b3899e6 to your computer and use it in GitHub Desktop.
Bootstrap Animated Navigation Bar

Bootstrap Animated Navigation Bar

Simple animation with bootstrap navigation bar. This i example is to show new guys out there how easy it can be,. Don't give up, learn every day.

A Pen by Stefan Omerovic on CodePen.

License.

<!-- Navigation Bar -->
<nav class="navbar navbar-default navbar-fixed-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#resNav">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="#" class="navbar-brand">Company Logo</a>
</div>
<div class="collapse navbar-collapse" id="resNav">
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Team</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</nav> <!-- End of Navigation Bar -->
<!-- Jumbotron -->
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="jumbotron">
<h1>Hello World!</h1>
<p class="lead">Some simple text so you can see how awesome i am.</p>
<button type="btn" class="btn btn-primary">Click me!</button>
</div>
</div>
</div>
</div> <!-- End of Jumbotron -->
<!-- Simple Article -->
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="text-center">
<h3>Simple article</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
</div> <!-- End of Simple Article -->
// Toggle Animation by Class
$(window).scroll(function(){
if($(document).scrollTop() > 100){
$('nav').addClass('animate');
}else{
$('nav').removeClass('animate');
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
/* Navigation Bar */
.navbar{
padding: 20px 10px 20px 0px;
background-color: #28a7e9;
transition: all ease 0.4s;
}
.navbar-brand{
font-size: 22px;
color: white !important;
}
.navbar .navbar-nav li a{
font-size: 16px;
color: white;
}
/* Animation */
.animate{
padding: 0px 10px 0px 0px;
transition: all ease 0.4s;
}
/* Jumbotron */
.jumbotron{
margin-top: 110px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment