title: Bootstrap 4 scroll to div
body: <p>Im using Bootstrap 4 and for some reason the scroll to div function is only working on mobile phone/smaller screen sizes.</p>
  
  <p>Javascript code:</p>
  
  <pre><code>  &lt;script&gt;
      $(".navbar-nav li a").click(function(event) {
          if (!$(this).parent().hasClass('dropdown'))
              $(".navbar-collapse").collapse('hide');
      });   &lt;/script&gt;
  </code></pre>
  
  <p>Navbar link:</p>
  
  <pre><code>        &lt;li class="nav-item"&gt;
              &lt;a class="nav-link" href="#about-us"&gt;&lt;button type="button" class="btn btn-green"&gt;About&lt;/button&gt;&lt;/a&gt;
          &lt;/li&gt;
  </code></pre>
  
  <p>Div:</p>
  
  <pre><code>  &lt;div class="about" id="about-us"&gt;
      &lt;div class="container"&gt;
        test
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>