Affix
Fix the element to a specific visible area.
Basic Usage
Affix is fixed at the top of the page by default.
Target Container
You can set target
attribute to keep the affix in the container at all times. It will be hidden if out of range.
Fixed Position
The affix component provides two fixed positions: top
and bottom
.
Affix API
Affix Attributes
Name | Description | Type | Default | Required |
---|---|---|---|---|
offset | offset distance. | number | 0 | No |
position | position of affix. | enum | 'top' | No |
target | target container. (CSS selector) | string | — | No |
z-index | z-index of affix | number | 100 | No |
Affix Events
Name | Description | Type |
---|---|---|
change | triggers when fixed state changed. | Function |
scroll | triggers when scrolling. | Function |
Affix Exposes
Method | Description | Type |
---|---|---|
update | update affix state manually | Function |
updateRoot | update rootRect info | Function |
Affix Slots
Name | Description |
---|---|
default | customize default content. |