Sticky
Angular Bootstrap 5 Sticky
Sticky is a component which allows elements to be locked in a particular area of the page. It is often used in navigation menus.
Note: Read the API tab to find all available options and advanced customization
Basic example
To start using sticky just use a mdbSticky
directive on the element you want to pin
Sticky bottom
You can pin element to bottom by adding
[stickyPosition]="'bottom'"
Boundary
Set [stickyBoundary]="boundary"
so that sticky only works inside the parent
element. Remember to set the correct parent height.
Outer element as a boundary
You can specify an element to be the sticky boundary.

Direction
Default direction of sticky component is down
. You can change it by setting
data-mdb-sticky-direction="up"
or
data-mdb-sticky-direction="both"
Sticky - API
Import
Inputs
Name | Type | Default | Description |
---|---|---|---|
stickyActiveClass
|
String | '' |
Set custom active class |
stickyBoundary
|
HTMLElement | null |
set the reference of the boundary element |
stickyDelay
|
Number | 0 |
Set the number of pixels beyond which the item will be pinned |
stickyDirection
|
String | 'down' |
Set the scrolling direction for which the element is to be stikcky |
stickyOffset
|
Number | 0 |
Set the distance from the top edge of the element for which the element is sticky |
stickyPosition
|
String | 'top' |
Set the edge of the screen the item should stick to |
Outputs
Name | Type | Description |
---|---|---|
active
|
EventEmitter<void> | This event fires immediately when sticky start |
inactive
|
EventEmitter<void> | This event fires immediately when sticky stop |