From 16b4ac0d8fd5fd2aa588a8b486b71b449e3821ca Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 27 Jul 2012 10:35:15 -0700 Subject: [PATCH] add docs for sub menu support on dropdowns, add caret via :after to submenu toggles --- docs/assets/css/bootstrap.css | 20 ++++++++- docs/components.html | 55 ++++++++++++++++++------ docs/templates/pages/components.mustache | 55 ++++++++++++++++++------ less/dropdowns.less | 19 +++++++- 4 files changed, 123 insertions(+), 26 deletions(-) diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index f24baf5810..c59a7fd974 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -2763,7 +2763,7 @@ table .span24 { .dropdown-submenu > .dropdown-menu { top: 0; left: 100%; - margin-top: -5px; + margin-top: -6px; margin-left: -1px; -webkit-border-radius: 0 6px 6px 6px; -moz-border-radius: 0 6px 6px 6px; @@ -2774,6 +2774,24 @@ table .span24 { display: block; } +.dropdown-submenu > a:after { + display: block; + float: right; + width: 0; + height: 0; + margin-top: 5px; + margin-right: -10px; + border-color: transparent; + border-left-color: #cccccc; + border-style: solid; + border-width: 5px 0 5px 5px; + content: " "; +} + +.dropdown-submenu:hover > a:after { + border-left-color: #ffffff; +} + .dropdown .dropdown-menu .nav-header { padding-right: 20px; padding-left: 20px; diff --git a/docs/components.html b/docs/components.html index c36eec9403..719a9e8743 100644 --- a/docs/components.html +++ b/docs/components.html @@ -122,16 +122,7 @@
  • Another action
  • Something else here
  • - +
  • Separated link
  • @@ -162,10 +153,50 @@

    Options

    -

    ...

    +

    Align menus to the right and add include additional levels of dropdowns.

    Aligning the menus

    -

    ...

    +

    Add .pull-right to a .dropdown-menu to right align the dropdown menu.

    +
    +<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dLabel">
    +  ...
    +</ul>
    +
    + +

    Sub menus on dropdowns

    +

    Add an extra level of dropdown menus, appearing on hover like those of OS X, with some simple markup additions. Add .dropdown-submenu to any li in an existing dropdown menu for automatic styling.

    +
    + +
    +
    +<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    +  ...
    +  <li class="dropdown-submenu">
    +    <a tabindex="-1" href="#">More options</a>
    +    <ul class="dropdown-menu">
    +      ...
    +    </ul>
    +  </li>
    +</ul>
    +
    + diff --git a/docs/templates/pages/components.mustache b/docs/templates/pages/components.mustache index e9022ee125..7ac31e2191 100644 --- a/docs/templates/pages/components.mustache +++ b/docs/templates/pages/components.mustache @@ -51,16 +51,7 @@
  • {{_i}}Another action{{/i}}
  • {{_i}}Something else here{{/i}}
  • - +
  • {{_i}}Separated link{{/i}}
  • {{! /example }} @@ -91,10 +82,50 @@

    {{_i}}Options{{/i}}

    -

    {{_i}}...{{/i}}

    +

    {{_i}}Align menus to the right and add include additional levels of dropdowns.{{/i}}

    {{_i}}Aligning the menus{{/i}}

    -

    {{_i}}...{{/i}}

    +

    {{_i}}Add .pull-right to a .dropdown-menu to right align the dropdown menu.{{/i}}

    +
    +<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dLabel">
    +  ...
    +</ul>
    +
    + +

    {{_i}}Sub menus on dropdowns{{/i}}

    +

    {{_i}}Add an extra level of dropdown menus, appearing on hover like those of OS X, with some simple markup additions. Add .dropdown-submenu to any li in an existing dropdown menu for automatic styling.{{/i}}

    +
    + +
    {{! /example }} +
    +<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
    +  ...
    +  <li class="dropdown-submenu">
    +    <a tabindex="-1" href="#">{{_i}}More options{{/i}}</a>
    +    <ul class="dropdown-menu">
    +      ...
    +    </ul>
    +  </li>
    +</ul>
    +
    + diff --git a/less/dropdowns.less b/less/dropdowns.less index a36c3a416f..fb85ca57af 100644 --- a/less/dropdowns.less +++ b/less/dropdowns.less @@ -176,7 +176,7 @@ .dropdown-submenu > .dropdown-menu { top: 0; left: 100%; - margin-top: -5px; + margin-top: -6px; margin-left: -1px; -webkit-border-radius: 0 6px 6px 6px; -moz-border-radius: 0 6px 6px 6px; @@ -186,6 +186,23 @@ 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: darken(@dropdownBackground, 20%); + margin-top: 5px; + margin-right: -10px; +} +.dropdown-submenu:hover > a:after { + border-left-color: @dropdownLinkColorHover; +} + // Tweak nav headers // -----------------