title: Bootstrap dropdown not working on mobile on click
body: <p>I have added a dropdown to my website but it is not working properly on mobile devices when the nav bar is collapsed. When I click on dropdown it closes the navbar instead of showing the items under the dropdown.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.dropdown-submenu {
    position: relative;
  }
  
  .dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -1px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
  
  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"&gt;
  
  &lt;nav class="navbar navbar-default navbar-fixed-top"&gt;
      &lt;div class="container"&gt;
          &lt;!-- Brand and toggle get grouped for better mobile display --&gt;
          &lt;div class="navbar-header page-scroll"&gt;
              &lt;button type="button" class="navbar-toggle" data-toggle="collapse"
                      data-target="#bs-example-navbar-collapse-1"&gt;
                  &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
                  &lt;span class="icon-bar"&gt;&lt;/span&gt;
              &lt;/button&gt;
              &lt;a class="navbar-brand" href="#page-top"&gt;Name&lt;/a&gt;
          &lt;/div&gt;
  
          &lt;!-- Collect the nav links, forms, and other content for toggling --&gt;
          &lt;div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"&gt;
              &lt;ul class="nav navbar-nav navbar-right"&gt;
                  &lt;li class="hidden"&gt;
                      &lt;a href="#page-top"&gt;&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li class="page-scroll"&gt;
                      &lt;a href="#portfolio"&gt;Portfolio&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li class="dropdown"&gt;
                      &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;Games &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
                      &lt;ul class="dropdown-menu"&gt;
                          &lt;li&gt;&lt;a href="/Spikes" target="_blank"&gt;Avoid The Spikes&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="/SpaceShooter" target="_blank"&gt;Space Shooter&lt;/a&gt;&lt;/li&gt;
                          &lt;!--&lt;li role="separator" class="divider"&gt;&lt;/li&gt;--&gt;
                          &lt;!--&lt;li class="dropdown-header"&gt;Nav header&lt;/li&gt;--&gt;
                          &lt;!--&lt;li&gt;&lt;a href="#"&gt;Separated link&lt;/a&gt;&lt;/li&gt;--&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
                  &lt;/ul&gt;
                  &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>