A hardware-accelerated, zero-dependency continuous scrolling ticker component for vanilla JavaScript. Synchronizes with the browser's refresh rate via requestAnimationFrame, prevents layout reflows with 3D CSS transforms, and supports bidirectional velocity controls.
# Install via NPM
npm install @modracx/marquee-js
# Or include via CDN script tag
<script src="https://cdn.jsdelivr.net/npm/@modracx/marquee-js/dist/marquee.min.js"></script>
import { Marquee } from '@modracx/marquee-js';
const marquee = new Marquee('#partner-logos', {
speed: 45, // Pixels per second
direction: 'left', // 'left' | 'right' | 'up' | 'down'
pauseOnHover: true, // Pause motion when mouse enters track
gap: 32, // Spacing between repeated loops in px
autoFill: true // Clone items automatically to fill viewport width
});
3. Options & API Configuration
Option
Type
Default
Description
speed
number
50
Movement velocity in pixels per second
direction
'left' | 'right'
'left'
Horizontal scroll direction
pauseOnHover
boolean
true
Temporarily halt animation when user points or touches container
gap
number
24
Padding gap in pixels between cloned items
reverseOnScroll
boolean
false
Reverse marquee direction dynamically when user scrolls down the page
4. Programmatic Methods
// Pause / Resume animation
marquee.pause();
marquee.play();
// Update velocity dynamically
marquee.setSpeed(120);
// Reverse current direction
marquee.reverse();
// Destroy instance and restore original DOM tree
marquee.destroy();