From 6ccf588a8e08a9f99e6a56f9201a4348eb946cde Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 17 Feb 2013 13:35:14 -0800 Subject: [PATCH] Restore submenu support --- docs/assets/css/bootstrap.css | 58 +++++++++++++++++++++- docs/assets/css/docs.css | 14 ++++++ docs/components.html | 93 ++++++++++++++++++++++++++++++++++- less/dropdowns.less | 68 +++++++++++++++++++++++-- 4 files changed, 225 insertions(+), 8 deletions(-) diff --git a/docs/assets/css/bootstrap.css b/docs/assets/css/bootstrap.css index 38ae1fdeb2..b45d7e101e 100644 --- a/docs/assets/css/bootstrap.css +++ b/docs/assets/css/bootstrap.css @@ -2685,8 +2685,10 @@ fieldset[disabled] .btn-link:focus { white-space: nowrap; } -.dropdown-menu li > a:hover, -.dropdown-menu li > a:focus { +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus, +.dropdown-submenu:hover > a, +.dropdown-submenu:focus > a { color: #ffffff; text-decoration: none; background-color: #357ebd; @@ -2753,6 +2755,58 @@ fieldset[disabled] .btn-link:focus { margin-bottom: 1px; } +.dropdown-submenu { + position: relative; +} + +.dropdown-submenu > .dropdown-menu { + top: 0; + left: 100%; + margin-top: -6px; + margin-left: -1px; + border-top-left-radius: 0; +} + +.dropdown-submenu:hover > .dropdown-menu { + display: block; +} + +.dropup .dropdown-submenu > .dropdown-menu { + top: auto; + bottom: 0; + margin-top: 0; + margin-bottom: -2px; + border-bottom-left-radius: 0; +} + +.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-submenu.pull-left { + float: none; +} + +.dropdown-submenu.pull-left > .dropdown-menu { + left: -100%; + margin-left: 10px; + border-top-right-radius: 0; +} + .dropdown .dropdown-menu .nav-header { padding-right: 20px; padding-left: 20px; diff --git a/docs/assets/css/docs.css b/docs/assets/css/docs.css index e2cc921b87..8a06cbc457 100644 --- a/docs/assets/css/docs.css +++ b/docs/assets/css/docs.css @@ -295,6 +295,20 @@ section > ul li { margin-right: auto; } +/* Example dropdowns */ +.bs-docs-example > .dropdown > .dropdown-menu, +.bs-docs-example-submenu > .pull-left > .dropup > .dropdown-menu, +.bs-docs-example-submenu > .pull-left > .dropdown > .dropdown-menu { + position: static; + display: block; + margin-bottom: 5px; +} +.bs-docs-example-submenu { + min-height: 180px; +} +.bs-docs-example-submenu > .pull-left + .pull-left { + margin-left: 20px; +} /* Example templates diff --git a/docs/components.html b/docs/components.html index bc5d7a2b37..b80eb6e714 100644 --- a/docs/components.html +++ b/docs/components.html @@ -53,7 +53,7 @@ title: Components

Wrap the dropdown's trigger and the dropdown menu within .dropdown, or another element that declares position: relative;. Then add the menu's HTML.