]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
add basic support for sub menus in dropdown menus
authorMark Otto <markotto@twitter.com>
Fri, 27 Jul 2012 17:06:54 +0000 (10:06 -0700)
committerMark Otto <markotto@twitter.com>
Fri, 27 Jul 2012 17:06:54 +0000 (10:06 -0700)
docs/assets/css/bootstrap.css
docs/components.html
docs/templates/pages/components.mustache
less/dropdowns.less

index 87922cf8809f3d9249283d9995ed5c50943637b3..f24baf58101e518b529afd2b08a240bc82dd78c4 100644 (file)
@@ -2687,7 +2687,8 @@ table .span24 {
 }
 
 .dropdown-menu li > a:hover,
-.dropdown-menu li > a:focus {
+.dropdown-menu li > a:focus,
+.dropdown-submenu:hover > a {
   color: #ffffff;
   text-decoration: none;
   background-color: #0088cc;
@@ -2728,11 +2729,6 @@ table .span24 {
   background-color: transparent;
 }
 
-.dropdown .dropdown-menu .nav-header {
-  padding-right: 20px;
-  padding-left: 20px;
-}
-
 .open {
   *z-index: 1000;
 }
@@ -2760,6 +2756,29 @@ table .span24 {
   margin-bottom: 1px;
 }
 
+.dropdown-submenu {
+  position: relative;
+}
+
+.dropdown-submenu > .dropdown-menu {
+  top: 0;
+  left: 100%;
+  margin-top: -5px;
+  margin-left: -1px;
+  -webkit-border-radius: 0 6px 6px 6px;
+     -moz-border-radius: 0 6px 6px 6px;
+          border-radius: 0 6px 6px 6px;
+}
+
+.dropdown-submenu:hover .dropdown-menu {
+  display: block;
+}
+
+.dropdown .dropdown-menu .nav-header {
+  padding-right: 20px;
+  padding-left: 20px;
+}
+
 .typeahead {
   margin-top: 2px;
   -webkit-border-radius: 4px;
index 181a8cbfcde0527df394c207a835e531bf21bf3f..c36eec94037c55698caeee5547d2c197bd48c7fb 100644 (file)
                 <li><a tabindex="-1" href="#">Another action</a></li>
                 <li><a tabindex="-1" href="#">Something else here</a></li>
                 <li class="divider"></li>
-                <li><a tabindex="-1" href="#">Separated link</a></li>
+                <li class="dropdown-submenu">
+                  <a tabindex="-1" href="#">Separated link</a>
+                  <ul class="dropdown-menu">
+                    <li><a tabindex="-1" href="#">Second level link</a></li>
+                    <li><a tabindex="-1" href="#">Second level link</a></li>
+                    <li><a tabindex="-1" href="#">Second level link</a></li>
+                    <li><a tabindex="-1" href="#">Second level link</a></li>
+                    <li><a tabindex="-1" href="#">Second level link</a></li>
+                  </ul>
+                </li>
               </ul>
             </div>
           </div>
 &lt;/ul&gt;
 </pre>
 
-
-          <hr class="bs-docs-separator">
-
-
           <h2>Markup</h2>
           <p>Looking at just the dropdown menu, here's the required HTML. You need to wrap the dropdown's trigger and the dropdown menu within <code>.dropdown</code>, or another element that declares <code>position: relative;</code>. Then just create the menu.</p>
 
 &lt;/div&gt;
 </pre>
 
-
-          <hr class="bs-docs-separator">
-
-
           <h2>Options</h2>
           <p>...</p>
 
index 52d5137c081c8ecbb84aed337204c0c5c4fa6afe..e9022ee12532979fa9826df1488cf18fe425691c 100644 (file)
                 <li><a tabindex="-1" href="#">{{_i}}Another action{{/i}}</a></li>
                 <li><a tabindex="-1" href="#">{{_i}}Something else here{{/i}}</a></li>
                 <li class="divider"></li>
-                <li><a tabindex="-1" href="#">{{_i}}Separated link{{/i}}</a></li>
+                <li class="dropdown-submenu">
+                  <a tabindex="-1" href="#">{{_i}}Separated link{{/i}}</a>
+                  <ul class="dropdown-menu">
+                    <li><a tabindex="-1" href="#">{{_i}}Second level link{{/i}}</a></li>
+                    <li><a tabindex="-1" href="#">{{_i}}Second level link{{/i}}</a></li>
+                    <li><a tabindex="-1" href="#">{{_i}}Second level link{{/i}}</a></li>
+                    <li><a tabindex="-1" href="#">{{_i}}Second level link{{/i}}</a></li>
+                    <li><a tabindex="-1" href="#">{{_i}}Second level link{{/i}}</a></li>
+                  </ul>
+                </li>
               </ul>
             </div>
           </div>{{! /example }}
 &lt;/ul&gt;
 </pre>
 
-
-          <hr class="bs-docs-separator">
-
-
           <h2>{{_i}}Markup{{/i}}</h2>
           <p>{{_i}}Looking at just the dropdown menu, here's the required HTML. You need to wrap the dropdown's trigger and the dropdown menu within <code>.dropdown</code>, or another element that declares <code>position: relative;</code>. Then just create the menu.{{/i}}</p>
 
 &lt;/div&gt;
 </pre>
 
-
-          <hr class="bs-docs-separator">
-
-
           <h2>{{_i}}Options{{/i}}</h2>
           <p>{{_i}}...{{/i}}</p>
 
index 5f62d27f0424c5de157d651507935395a59011c7..a36c3a416ffd193ad52e7905882f7d2aca031642 100644 (file)
@@ -96,7 +96,8 @@
 // Hover state
 // -----------
 .dropdown-menu li > a:hover,
-.dropdown-menu li > a:focus {
+.dropdown-menu li > a:focus,
+.dropdown-submenu:hover > a {
   text-decoration: none;
   color: @dropdownLinkColorHover;
   background-color: @dropdownLinkBackgroundHover;
   cursor: default;
 }
 
-// Tweak nav headers
-// -----------------
-// Increase padding from 15px to 20px on sides
-.dropdown .dropdown-menu .nav-header {
-  padding-left: 20px;
-  padding-right: 20px;
-}
-
 // Open state for the dropdown
 // ---------------------------
 .open {
   }
 }
 
+// Sub menus
+// ---------------------------
+.dropdown-submenu {
+  position: relative;
+}
+.dropdown-submenu > .dropdown-menu {
+  top: 0;
+  left: 100%;
+  margin-top: -5px;
+  margin-left: -1px;
+  -webkit-border-radius: 0 6px 6px 6px;
+     -moz-border-radius: 0 6px 6px 6px;
+          border-radius: 0 6px 6px 6px;
+}
+.dropdown-submenu:hover .dropdown-menu {
+  display: block;
+}
+
+
+// Tweak nav headers
+// -----------------
+// Increase padding from 15px to 20px on sides
+.dropdown .dropdown-menu .nav-header {
+  padding-left: 20px;
+  padding-right: 20px;
+}
+
 // Typeahead
 // ---------
 .typeahead {