Skip to content

jakezhong/paralmaxjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paralmax.js

Paralmax is a JQuery responsive parallax plugin for multiple uses, including full size section background image, page parallax elements and more based on different use cases. With many built-in settings, users can set parallax speed, resize background image to full size or not, disable it below specific screen size, offset of the parallax element from it's center. The advantage of Paralmax is that it only adds parallax effet to elements, but not changes their style/looking, so users can easily customise/style any elements with pure HTML or CSS (position, size, image, background, content, etc).

Link to Files

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
<script src="js/paramax.js" type="text/javascript"></script>

Set up Codes

HTML Code

Simply add class .parallax-object to the elements that you want to parallax.

<div class="parallax-object">
    <img src="images/2.jpg" alt="">
</div>

JQuery Call

jQuery(function($){
    $(window).on('load', function() {
        // PARALLAX FUNCTIN CALL
        $(".parallax-object").paralmax();
    });
});

No built-in CSS is used/necessary, just style your elements to however you like before you parallax them.

HTML Data Options

Speed ( float, from 0.x to x.0 )

0 means the parallax element will be fixed in place, in this case, you don't need Paralmax. 1 means the same speed as page scoll, x.0 Means x times of the page scrolling speed. Default is 0.5.

<div data-speed="0.5"></div>

Resize ( boolean, true or false )

Resize the image to cover the whole parallax area, usually used for full-size background image that has smaller size than the container.

<div data-resize="true"></div>

Offset ( float, from 0 to 1 )

0 means the parallax element will not have any offset from it's top, 1 means the parallax element will be posited to it's bottom when it starts, default is 0.

<div data-offset="0.5"></div>

Breakpoint ( boolean, true or false )

Disable paralalx effect while below the specific screen size.

<div data-breakpoint="768"></div>

License

Copyright 2018 Jake Zhong

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A parallax effect plugin that can ensure the background size covers the whole container without causing any white space around and it is also responsive for any devices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published