diff options
| author | Mark Otto <[email protected]> | 2013-12-14 13:22:56 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-12-14 13:22:56 -0800 |
| commit | 11c6ab767cab5384188a301f7c9366b212432e81 (patch) | |
| tree | d25fa355c6eb3a20d6ea3703c88e9e42fbf1c0e7 /less/dropdowns.less | |
| parent | 914f5e6a1d6faf57988cd26c31200796a4b743a9 (diff) | |
| download | bootstrap-11c6ab767cab5384188a301f7c9366b212432e81.tar.xz bootstrap-11c6ab767cab5384188a301f7c9366b212432e81.zip | |
Fixes #10370: Improved and deprecated dropdown menu alignment options
* Removes an old pair of selectors that didn’t properly target the
right-aligned navbar alignment of dropdown menus.
* Deprecates the `.pull-right` alignment in favor of a more specific
and unique class name.
* Adds `.dropdown-menu-right` as the new alignment class. This is then
mixin-ed into the `.navbar-right.navbar-nav` dropdown menus for
auto-alignment.
* To override that auto-alignment, use `.dropdown-menu-left` as needed.
Diffstat (limited to 'less/dropdowns.less')
| -rw-r--r-- | less/dropdowns.less | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/less/dropdowns.less b/less/dropdowns.less index 4bdc223fc..dde2038e3 100644 --- a/less/dropdowns.less +++ b/less/dropdowns.less @@ -46,6 +46,8 @@ background-clip: padding-box; // Aligns the dropdown menu to right + // + // Deprecated as of 3.1 in favor of `.dropdown-menu-[dir]` &.pull-right { right: 0; left: auto; @@ -126,6 +128,25 @@ } } +// Menu positioning +// +// Add extra class to `.dropdown-menu` to flip the alignment of the dropdown +// menu with the parent. +.dropdown-menu-right { + left: auto; // Reset the default from `.dropdown-menu` + right: 0; +} +// With v3, we enabled auto-flipping if you have a dropdown within a right +// aligned nav component. To enable the undoing of that, we provide an override +// to restore the default dropdown menu alignment. +// +// This is only for left-aligning a dropdown menu within a `.navbar-right` or +// `.pull-right` nav component. +.dropdown-menu-left { + left: 0; + right: auto; +} + // Dropdown section headers .dropdown-header { display: block; @@ -180,7 +201,12 @@ @media (min-width: @grid-float-breakpoint) { .navbar-right { .dropdown-menu { - .pull-right > .dropdown-menu(); + .dropdown-menu-right(); + } + // Necessary for overrides of the default right aligned menu. + // Will remove come v4 in all likelihood. + .dropdown-menu-left { + .dropdown-menu-left(); } } } |
