How to make animated navbar using Bootstrap + JavaScript?

Hello, i have two questions. How do i an animated navbar using bootstrap and Javascript?

I want that when someone scroll down, navbar changes color,opacity and something like that.

I have this JavaScript, but i dont know how to use it. Well i know how to use it, but everytime it doesnt do nothing.

And my scnd question is, how can i change text color in FAQ
(navbar), when i add code “color: red;” in class “nav-link” in bootstrap.css, it doesnt do nothing.

$(document).ready(function() {
$(window).scroll(function() {
if($(document).scrollTop() > 10) {
else {

my html code here

    <a class="navbar-brand" href="#"><img src="img/logo.png"/></a>
    <!--Navigation Mobile menu-->
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" 
       aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item active">
          <a class="nav-link" href="#">Domů<span class="sr-only">(current)</span></a>
        <li class="nav-item">
          <a class="nav-link" href="#">Články</a>
        <li class="nav-item dropdown">
          <a class="nav-link" href="#">Fotogalerie</a>
        <li class="nav-item dropdown">
          <a class="nav-link" href="#">FAQ</a>
      <form class="form-inline my-2 my-lg-0">
        <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>

and i am using bootstrap.css with my little changes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.