0.2.0

The scroll feature smoothly scrolls the page to bring the active step's target element into view. It uses a custom requestAnimationFrame animation so duration, easing, and offset are fully configurable.

Config

PropertyTypeDefaultDescription
blockScrollLogicalPositioncenterVertical alignment — start, center, end, nearest
inlineScrollLogicalPositionnearestHorizontal alignment
durationnumber400Animation duration in ms. 0 for instant jump.
easingBordaScrollEasingease-in-outBuilt-in preset or custom function
offset.xnumber0Horizontal pixel offset
offset.ynumber0Vertical pixel offset
isLockedbooleanfalseBlock manual page scroll while the tour is active. Set true to lock scrolling.
await borda.mount({
  steps: [
    {
      target: '#intro-section',
      title: 'Welcome',
      description: 'First step starts at the top of the page.',
      placement: 'bottom-center',
    },
    {
      target: '#bottom-section',
      title: 'Down here',
      description: 'The page scrolled to this element automatically.',
      placement: 'top-center',
    },
  ],
  scroll: {
    block: 'center',
    duration: 600,
    easing: 'ease-in-out',
    offset: { y: -20 },
  },
});

Easing presets

PresetDescription
linearConstant speed
easeDefault browser easing
ease-inSlow start, fast end
ease-outFast start, slow end
ease-in-outSlow start and end

Pass a custom function for full control:

scroll: {
  easing: (progress) => progress * progress, // quadratic ease-in
}

Disabling scroll

Pass false to disable automatic scrolling entirely:

await borda.mount({
  steps: [...],
  scroll: false,
});

When animation.isEnabled is false globally, scroll still runs but becomes an instant jump regardless of duration.

Runtime API

// Scroll to any element programmatically
await instance.scroll.scrollTo(document.getElementById('target'));

// Check if a scroll animation is in progress
instance.scroll.isScrolling;