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.

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
offsetoffset distancenumber0
positionposition of affixstringtop / bottomtop
targettarget container (CSS selector)string
z-indexz-index of affixnumber100

Events

Event NameDescriptionParameters
changetriggers when fixed state changed(value: boolean)
scrolltriggers when scrollingscroll top and fixed state

Methods

MethodDescriptionParameters
updateupdate affix state manually

Slots

NameDescription
customize default content