From 6aa15eb01f2e50e394ae172ff41e5bc0583de6da Mon Sep 17 00:00:00 2001 From: Robert McLaws Date: Sun, 16 Sep 2012 03:02:31 -0400 Subject: Support for left-opening dropdown submenus Adds a new class called .dropdown-submenu-left. It is useful when you have a .pull-right DropDown that has submenus. Without this, the menu opens left past the page boundary, which can trigger the scrollbars and cause other nastiness. --- less/dropdowns.less | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'less/dropdowns.less') diff --git a/less/dropdowns.less b/less/dropdowns.less index bed158612..9622d2d46 100644 --- a/less/dropdowns.less +++ b/less/dropdowns.less @@ -163,7 +163,6 @@ .dropdown-submenu { position: relative; } - // Default dropdowns .dropdown-submenu > .dropdown-menu { top: 0; @@ -207,6 +206,40 @@ border-left-color: @dropdownLinkColorHover; } +// Left-opening Sub menus +// --------------------------- +.dropdown-submenu-left { + position: relative; +} +.dropdown-submenu-left > .dropdown-menu { + top: 0; + left: -100%; + margin-top: -6px; + margin-left: -1px; + -webkit-border-radius: 6px 0px 6px 6px; + -moz-border-radius: 6px 0px 6px 6px; + border-radius: 6px 0px 6px 6px; +} +.dropdown-submenu-left:hover > .dropdown-menu { + display: block; +} + +.dropdown-submenu-left > a:before { + display: block; + content: " "; + float: left; + width: 0; + height: 0; + border-color: transparent; + border-style: solid; + border-width: 5px 5px 5px 0px; + border-right-color: darken(@dropdownBackground, 20%); + margin-top: 5px; + margin-left: -10px; +} +.dropdown-submenu-left:hover > a:after { + border-right-color: @dropdownLinkColorHover; +} // Tweak nav headers // ----------------- -- cgit v1.2.3 From 1b814458c9476c32a92390e9e5cd989a51d04f05 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Mon, 1 Oct 2012 16:41:13 -0700 Subject: improve dropdown submenu docs; add docs for left submenu; remove all dupe css for left submenu --- less/dropdowns.less | 47 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'less/dropdowns.less') diff --git a/less/dropdowns.less b/less/dropdowns.less index 9622d2d46..5ed279167 100644 --- a/less/dropdowns.less +++ b/less/dropdowns.less @@ -206,39 +206,20 @@ border-left-color: @dropdownLinkColorHover; } -// Left-opening Sub menus -// --------------------------- -.dropdown-submenu-left { - position: relative; -} -.dropdown-submenu-left > .dropdown-menu { - top: 0; - left: -100%; - margin-top: -6px; - margin-left: -1px; - -webkit-border-radius: 6px 0px 6px 6px; - -moz-border-radius: 6px 0px 6px 6px; - border-radius: 6px 0px 6px 6px; -} -.dropdown-submenu-left:hover > .dropdown-menu { - display: block; -} - -.dropdown-submenu-left > a:before { - display: block; - content: " "; - float: left; - width: 0; - height: 0; - border-color: transparent; - border-style: solid; - border-width: 5px 5px 5px 0px; - border-right-color: darken(@dropdownBackground, 20%); - margin-top: 5px; - margin-left: -10px; -} -.dropdown-submenu-left:hover > a:after { - border-right-color: @dropdownLinkColorHover; +// Left aligned submenus +.dropdown-submenu.pull-left { + // Undo the float + // Yes, this is awkward since .pull-left adds a float, but it sticks to our conventions elsewhere. + float: none; + + // Positioning the submenu + > .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; + } } // Tweak nav headers -- cgit v1.2.3