Skip to main content
Jarallax provides multiple ways to initialize parallax effects using vanilla JavaScript, supporting both modern ESM imports and traditional UMD script tags.

Installation

Install Jarallax via npm:
Or use a CDN for quick prototyping:

Initialization Methods

Jarallax supports three initialization patterns in vanilla JavaScript:
Use ES Modules for modern JavaScript applications with bundlers or native browser support.
The video extension is optional and only needed if you want to use YouTube, Vimeo, or self-hosted video backgrounds.

Complete Examples

ESM with CDN

Here’s a complete working example using ES Modules from a CDN:

UMD with Script Tags

This example uses traditional script tags for maximum browser compatibility:

Data Attribute Initialization

Use data attributes for zero-JavaScript initialization:

HTML Structure

Jarallax requires specific HTML structure for the parallax effect to work:
Using the <img> tag with the jarallax-img class is recommended for better SEO and accessibility.

Configuration Options

Customize the parallax effect with these options:

Methods

Control parallax instances programmatically:

Events

Listen to parallax events for custom behaviors:

Video Backgrounds

Jarallax supports YouTube, Vimeo, and self-hosted video backgrounds:
Self-hosted videos should include at least one format (mp4, webm, or ogv) for browser compatibility.

Browser Support

Jarallax works in all modern browsers:
  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)
  • Opera (latest)
For older browsers, the UMD build provides the best compatibility. ESM requires browsers with native ES6 module support.

Next Steps

React & Next.js

Learn how to integrate Jarallax with React and Next.js applications

jQuery Integration

Use Jarallax with jQuery for enhanced compatibility

API Reference

Explore all available methods and options

Advanced Usage

Discover advanced configuration and customization options