0

I'm about to change over a decent sized website to use Bootstrap. In the navbar the About has 2 drop downs, Ahepa 215 and AHEPA. On Ahepa 215 I'm trying to add Brothers as a submenu to it. I must be overlooking something simple. This is the live test page http://ahepa215.org/ahepamenu.html The custom css is in the snippet box.

/* Navbar */

#primary-navbar {
  background: #3193de;
  margin-bottom: 0;
}
/* we overwrite the default navbar style from Bootstrap */

nav.navbar {
  background: #3193de;
  font-size: 18px;
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
  min-height: 34px;
}
/* The toggle unit (there is more stuff in there..) */

.navbar-header .navbar-toggle {
  border: 0;
}
.navbar-header .navbar-toggle span.icon-bar {
  background: #ffffff;
}
.navbar-header .navbar-toggle:hover span.icon-bar {
  background: #3193de;
}
/* The Logo/Start Button on mobile devices */

a.navbar-brand:link,
a.navbar-brand:visited {
  color: #ffffff;
}
a.navbar-brand:hover,
a.navbar-brand:focus {
  color: #c1c1c1;
}
/* First Level Main nav */

ul.nav {
  /* Menu style */
}
ul.nav li.active {
  background: #c1c1c1;
}
ul.nav li.active a:link,
ul.nav li.active a:visited {
  color: #666666;
}
ul.nav li a:link,
ul.nav li a:visited {
  color: #ffffff;
}
ul.nav li a:hover,
ul.nav li a:focus {
  color: #666666;
}
/* Our resposive dropdown */

ul.dropdown-menu {
  border-radius: 0;
  background: #3193de;
  width: 100%;
  margin: 0;
}
ul.dropdown-menu li a:link,
ul.dropdown-menu li a:visited {
  color: #ffffff;
  padding: 5px 15px;
}
ul.dropdown-menu li a:hover,
ul.dropdown-menu li a:focus {
  color: #666666;
}
.dropdown-submenu {
  position: relative;
}
.dropdown-submenu>.dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -6px;
  margin-left: -1px;
  - webkit-border-radius: 0 6px 6px 6px;
  -moz-border-radius: 0 6px 6px;
  border-radius: 0 6px 6px 6px;
}
.dropdown-submenu:hover>.dropdown-menu {
  display: block;
}
.dropdown-submenu>a:after {
  display: block;
  content: " ";
  float: right;
  width: 0;
  height: 0;
  border-color: transparent;
  border-style: solid;
  border-width: 5px 0 5px 5px;
  border-left-color: #ccc;
  margin-top: 5px;
  margin-right: -10px;
}
.dropdown-submenu:hover>a:after {
  border-left-color: #fff;
}
.dropdown-submenu.pull-left {
  float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
  left: -100%;
  margin-left: 10px;
  -webkit-border-radius: 6px 0 6px 6px;
  -moz-border-radius: 6px 0 6px 6px;
  border-radius: 6px 0 6px 6px;
}
<div class="row main-navigation-container navbar-fixed-top" id="primary-navbar">
  <nav class="navbar">
    <div class="container-fluid">v
      <!-- Mobile Toggle Button and stuff -->
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#primary-navigation" 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="AHEPA215" title="AHEPA 215">&nbsp; AHEPA 215</a>
      </div>
      <!-- End of mobile toggle button -->
      <!-- Start of the navbar -->
      <div class="collapse navbar-collapse" id="primary-navigation">
        <ul class="nav  nav-justified">
          <li><a href="index.html">Home<span class="sr-only">(current)</span></a>
          </li>

          <li><a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">About <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><a href="#">AHEPA</a>
              </li>
              <li class="dropdown-submenu">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">AHEPA 215</a>
                <ul class="dropdown-menu">
                  <li><a href="#">Brothers</a>
                  </li>
                </ul>
              </li>
            </ul>


            <li><a href="scholarship.html">Scholarships</a>
            </li>
            <li><a href="photos.html">Photos</a>
            </li>
            <li><a href="join.html">Join</a>
            </li>
            <li><a href="calendar.html">Calendar</a>
            </li>
            <li><a href="contact.html">Contact</a>
            </li>
        </ul>
      </div>
    </div>
  </nav>

</div>
Cœur
  • 37,241
  • 25
  • 195
  • 267
mlegg
  • 784
  • 6
  • 19
  • 35
  • Possible duplicate of [Bootstrap 3 dropdown sub menu missing](http://stackoverflow.com/questions/18023493/bootstrap-3-dropdown-sub-menu-missing) – max Feb 06 '17 at 16:18
  • I edited my original question. I figured out how to get the drop down on About and then another drop down on AHEPA 215 for Brothers. It works fine on a full screen (1366 x768 on my laptop) but when the screen is smaller the sub menu on About > AHEPA 215> Brothers doesn't show. – mlegg Feb 06 '17 at 18:05

1 Answers1

0

Add this CSS or replace nav-justified with navbar-nav class.

@media (max-width: 767px) {
  .nav.nav-justified .open .dropdown-menu {
    position: static;
    float: none;
    width: auto;
    margin-top: 0;
    background-color: transparent;
    border: 0;
    -webkit-box-shadow: none;
            box-shadow: none;
  }
}
max
  • 8,632
  • 3
  • 21
  • 55
  • Thanks I added that. Now can you define what is a big mess? I have – mlegg Feb 06 '17 at 18:30
  • Sorry, maybe not that big :) I think you shouldn't use `row` in your `primary-navbar` div. "Rows must be placed within a .container (fixed-width) or .container-fluid (full-width) for proper alignment and padding." http://getbootstrap.com/css/#grid-intro – max Feb 06 '17 at 18:36
  • OK I deleted row but the sub menu under AHEPA 215 for Brothers still doesn't show on less than my full width screen. – mlegg Feb 06 '17 at 18:42
  • I see that you removed `row` but you didn't add my CSS code. – max Feb 06 '17 at 18:56
  • I just did it again. I must have not saved it originally, The menu now works. Thank you so much! – mlegg Feb 06 '17 at 19:12
  • I just looked on my iPhone 6s and the Brothers sub menu does not show. :( – mlegg Feb 06 '17 at 19:36
  • That's because your dropdown submenu works on hover, wrap your CSS styles for dropdown submenu in media query (min-width: 768px). – max Feb 07 '17 at 11:58