1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 16:50:00 +02:00

Generate correct breakpoints for navbar-toggleable-* and generate toggleable without media query to never collapse

This commit is contained in:
Pierre-Denis Vanduynslager
2017-01-13 23:05:33 -05:00
committed by Mark Otto
parent d0b568470f
commit c1325a756e
3 changed files with 35 additions and 18 deletions

View File

@@ -16,9 +16,22 @@
// md
@function breakpoint-next($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null);
@return if($n, if($n < length($breakpoint-names), nth($breakpoint-names, $n + 1), null), null);
}
// Name of the previous breakpoint, or null for the first breakpoint.
//
// >> breakpoint-previous(sm)
// xs
// >> breakpoint-next(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))
// xs
// >> breakpoint-next(sm, $breakpoint-names: (xs sm md lg xl))
// xs
@function breakpoint-previous($name, $breakpoints: $grid-breakpoints, $breakpoint-names: map-keys($breakpoints)) {
$n: index($breakpoint-names, $name);
@return if($n != 1, nth($breakpoint-names, $n - 1), null);
};
// Minimum breakpoint width. Null for the smallest (first) breakpoint.
//
// >> breakpoint-min(sm, (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px))