# Scrollama

> Scrollytelling on IntersectionObserver: fires an event as each text step crosses a line, so a sticky graphic can change state.

Source: https://tastebase.ehsanulsiam.workers.dev/browse/scrollama

free

Scrollytelling on IntersectionObserver: fires an event as each text step crosses a line, so a sticky graphic can change state.

by Russell Samora (The Pudding)[GitHub](https://github.com/russellsamora/scrollama)[npm](https://npmjs.com/package/scrollama)

[visit](https://github.com/russellsamora/scrollama?utm_source=tastebase&utm_medium=referral&utm_content=detail-page)

[https://github.com/russellsamora/scrollama](https://github.com/russellsamora/scrollama?utm_source=tastebase&utm_medium=referral&utm_content=detail-preview)

## Try these

no preview

### [GSAP](https://tastebase.ehsanulsiam.workers.dev/browse/gsap)

Timeline animation engine with ScrollTrigger, SplitText, Flip and MorphSVG, now free including every plugin.

no preview

### [visx](https://tastebase.ehsanulsiam.workers.dev/browse/visx)

Airbnb's low-level D3 + React primitives (scales, shapes, axes) for custom charts.

no preview

### [Motion](https://tastebase.ehsanulsiam.workers.dev/browse/motion)

The default animation library for React (formerly Framer Motion): springs, gestures, layout and exit animations.

no preview

### [Lenis](https://tastebase.ehsanulsiam.workers.dev/browse/lenis)

Smooth, inertia-based wheel scrolling that keeps native scroll position, sticky and anchors working.

## Looks that pick it

[Scrollytellingfirst pick](https://tastebase.ehsanulsiam.workers.dev/looks/scrollytelling)

## For your agent

##### Install

`npm i scrollama`

##### Use it for

- a scrollytelling story with steps: text cards scroll past a sticky chart or map that changes at each step
- a data-journalism or explainer article where each paragraph triggers the next state of a graphic
- step progress (0 to 1) that scrubs a chart transition while one paragraph is in view

##### Skip it when

- pinned sections that scrub tweened animation with the scrollbar: use gsap (ScrollTrigger)
- fade-in reveals as sections enter: use motion's whileInView or CSS scroll-driven animations
- smooth wheel scrolling: that is lenis, which can sit underneath

##### What's inside10 free

- setup()
- onStepEnter
- onStepExit
- onStepProgress
- offsetTrigger
- resize()
- enable()
- disable()
- destroy()
- Custom offset (data-offset)

##### Facts

**Frameworks**
vanilla, react, vue, svelte, solid, angular

**Styling**
unstyled

**Weight**
tiny

**Accessibility**
ok

**Maturity**
established

**License**
MIT

**Price**
Free

##### Pairs with

[visx](https://tastebase.ehsanulsiam.workers.dev/browse/visx)[Motion](https://tastebase.ehsanulsiam.workers.dev/browse/motion)[Lenis](https://tastebase.ehsanulsiam.workers.dev/browse/lenis)

##### Alternatives

[GSAP](https://tastebase.ehsanulsiam.workers.dev/browse/gsap)

```
import scrollama from 'scrollama'

const scroller = scrollama()
scroller
  .setup({ step: '.story .step', offset: 0.6 })
  .onStepEnter(({ index, direction }) => setStep(index))

// teardown: scroller.destroy()
```

https://russellsamora.github.io/scrollama/basic/

Loading website

[Visit](https://github.com/russellsamora/scrollama?utm_source=tastebase&utm_medium=referral&utm_content=floating-pill)
