A small jQuery plugin to make parallax background image animation.
Markup
<div class="parallax-panel" data-src="images/01.png"></div>
Please note: data-src
is optional if you added background image via CSS.
Styles - optional
.parallax-panel {
min-height: 400px;
}
Initialization:
$('.parallax-panel').backgroundParallax();
You need to pass a object for options.
Defaults:
{
backgroundSize: 'cover',
backgroundPosition: '50% 0',
backgroundRepeat: 'no-repeat',
overflow: 'hidden'
}
Default: true
if mobile device found.
$('.parallax-panel').backgroundParallax({
css: {
backgroundSize: 'cover',
backgroundPosition: '50% 0',
backgroundRepeat: 'no-repeat',
overflow: 'hidden'
},
isMobile: false
});