diff --git a/scss/helpers/_position.scss b/scss/helpers/_position.scss index e0c4c2c110..63fe4504a2 100644 --- a/scss/helpers/_position.scss +++ b/scss/helpers/_position.scss @@ -18,10 +18,17 @@ z-index: $zindex-fixed; } -.sticky-top { - @supports (position: sticky) { - position: sticky; - top: 0; - z-index: $zindex-sticky; +// Responsive sticky top +@supports (position: sticky) { + @each $breakpoint in map-keys($grid-breakpoints) { + @include media-breakpoint-up($breakpoint) { + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); + + .sticky#{$infix}-top { + position: sticky; + top: 0; + z-index: $zindex-sticky; + } + } } } diff --git a/site/content/docs/4.3/helpers/position.md b/site/content/docs/4.3/helpers/position.md index 921e47a9f5..c44002ae97 100644 --- a/site/content/docs/4.3/helpers/position.md +++ b/site/content/docs/4.3/helpers/position.md @@ -31,3 +31,14 @@ Position an element at the top of the viewport, from edge to edge, but only afte {{< highlight html >}}
...
{{< /highlight >}} + +## Responsive sticky top + +Responsive variations also exist for `.sticky-top` utility. + +{{< highlight html >}} +
Stick to the top on viewports sized SM (small) or wider
+
Stick to the top on viewports sized MD (medium) or wider
+
Stick to the top on viewports sized LG (large) or wider
+
Stick to the top on viewports sized XL (extra-large) or wider
+{{< /highlight >}}