Skip to content

Affix

Basic Usage

Fixes elements relative to the window during native scrolling; can also be configured with scrollbar.

<template>
  <b-affix :offset="80">
    <b-button type="primary">Fixed at 80px from the top</b-button>
  </b-affix>
</template>

Fixed Position

Can set a fixed position at a distance from the bottom

<template>
  <b-affix :offset="20" position="bottom">
    <b-button type="primary">Fixed at 20px from the bottom</b-button>
  </b-affix>
</template>

Props

ParameterDescriptionTypeOptionsDefault
offsetTrigger offset from window positionNumber0
positionCan be set to offset from top or bottomStringtop、bottomtop
z-indexZ-index levelNumber10

Events

Event NameDescriptionReturn Value
changeTriggers when fixed state changestrue/false
scrollScroll response event, returns an object containing scrollTop and fixedObject

Slot

NameDescription
defaultWarning/alert content