Searching Open Sourcery

Type to search Open Sourcery.

Media & Content

Scrolling Content

An infinite marquee — hover to pause, drag to scrub, no dependencies.

v2.1.1@magic-spells/scrolling-content

$ npm i @magic-spells/scrolling-content

GitHubnpm

Live demo

PhysicsTimelinesMorphsSheetsPanelsMarqueesCartsTabs

Drag to scrub the marquee back and forth.

About

An infinite scrolling marquee web component. Loops any row of markup forever — logo walls, tickers, announcement bars — with hover-to-pause, drag-to-scrub, and a speed you can set from a media query.

Features

  • Measures your content and clones it until the track covers the container — six items or sixty, same markup
  • Adopts markup you authored yourself, so it never fights a framework that owns the DOM
  • Edit the content and every clone follows on the next frame
  • Speed in px/sec, overridable per breakpoint from CSS
  • Hover to pause, drag to scrub, both opt-out-able
  • Optional edge fade so content dissolves instead of clipping

Usage

<scrolling-content speed="60" fade>
  <scrolling-track>
    <span>🚀 Web Components</span>
    <span>⚡ Lightning Fast</span>
    <span>🎨 Fully Customizable</span>
  </scrolling-track>
</scrolling-content>

Configuration

AttributeDefaultDescription
speed60Scroll speed in pixels per second. Overridden by --scrolling-content-speed when that property is set.
directionleftleft or right.
pausedabsentBoolean. Reflected — this is the state start() and stop() write.
pause-on-hovertrueSet "false" to keep scrolling under the cursor.
dragtrueSet "false" to disable scrubbing.
fadeabsentBoolean, or a CSS length. Masks the left and right edges. Bare fade uses 4rem.

About, features, usage and options are taken from the package README.