Quick Start Guide
This guide will walk you through creating your first parallax effect with Jarallax. You’ll go from zero to a working parallax scrolling background in just a few steps.Basic Parallax Image
The simplest way to use Jarallax is with a background image and the<img> tag.
1
Add the HTML structure
Create a container element with the
jarallax class and an <img> element with the jarallax-img class:Add a minimum height to your parallax container so it has dimensions to work with.
2
Initialize Jarallax
Call the Or with custom options:
jarallax function on your elements:3
See it in action
Scroll the page and watch your background move at a different speed than your content!
Alternative: CSS Background Image
You can also use CSS background images instead of<img> tags:
Data Attribute Initialization
When using UMD mode, Jarallax can automatically initialize elements with thedata-jarallax attribute:
With data attributes, you can configure all options directly in HTML. For example:
data-speed="0.5", data-type="scale", data-img-position="0% 50%".Complete Working Example
Here’s a full HTML page with a working parallax effect:Video Background Example
Add a YouTube or Vimeo video as a parallax background:1
Load the video extension
2
Add HTML with video URL
3
Initialize with videoSrc option
- JavaScript
- Data Attribute
Supported Video Formats
Customizing Speed
Thespeed option controls how fast the background moves relative to scrolling:
Speed values range from -1.0 to 2.0:
< 0: Background moves in reverse0.0 - 0.9: Background moves slower (parallax effect)1.0: No parallax (fixed background)> 1.0: Background moves faster
Different Effect Types
Jarallax supports multiple effect types:Using with Picture Element
For responsive images with different sources:Disable on Mobile
Optionally disable parallax on mobile devices for better performance:Common Patterns
Hero Section
Multiple Sections
Troubleshooting
Parallax not working
Parallax not working
- Ensure the container has a defined height
- Check that CSS file is loaded
- Verify
jarallaxfunction is called after DOM is ready - Check browser console for errors
Image not showing
Image not showing
- Verify image path is correct
- Check that image has loaded (Network tab)
- Ensure CSS is properly loaded
- Try using
imgSrcoption directly:jarallax(element, { imgSrc: 'path/to/image.jpg' })
Performance issues on mobile
Performance issues on mobile
- Use the
disableParallaxoption to disable on mobile - Reduce image file sizes
- Consider using
disableVideofor video backgrounds on mobile
Next Steps
Now that you have a working parallax effect, explore more advanced features:Configuration Options
Learn about all available options and callbacks
API Reference
Explore methods and programmatic control
Video Backgrounds
Deep dive into video parallax features
Examples
Browse more example implementations
