Giter Site home page Giter Site logo

mominulbd / parallax_background Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lemehovskiy/parallax-background

0.0 1.0 0.0 2.34 MB

jQuery parallax background plugin based on GSAP

Home Page: https://lemehovskiy.github.io/parallax-background

JavaScript 100.00%

parallax_background's Introduction

parallaxBackground

Demo

https://lemehovskiy.github.io/parallax-background

Package Managers

# NPM
npm install parallax_background

Installation

Include js

<script src="TweenLite.min.js"></script>
<script src="CSSPlugin.min.js"></script>
<script src="jquery.min.js"></script>
<script src="parallax_background.js"></script>

Set HTML

<div class="parallax-background">
  <div class="parallax-inner" style="background-image: url('background-image.jpg')">
  </div>
</div>

Call the plugin

<script type="text/javascript">
    $(document).ready(function() {
      $('.parallax-background').parallaxBackground();
    });
</script>

In result

<html>
  <head>
  <title>My website</title>
  </head>
  <body>

  <div class="parallax-background">
    <div class="parallax-inner" style="background-image: url('background-image.jpg')">
    </div>
  </div>

  <script src="TweenLite.min.js"></script>
  <script src="CSSPlugin.min.js"></script>
  <script src="jquery.min.js"></script>
  <script src="parallax_background.js"></script>

  <script type="text/javascript">
      $(document).ready(function() {
        $('.parallax-background').parallaxBackground();
      });
  </script>

  </body>
</html>

Data Attribute Settings

In parallaxBackground you can add settings using the data-parallax-background attribute. You still need to call $(element).parallaxBackground() to initialize parallaxBackground on the element.

Example:

<div class="parallax-background" data-parallax-background='{"duration": 3, "zoom": 30}'>
  <div class="parallax-inner" style="background-image: url('background-image.jpg')">
  </div>
</div>

Settings

Option Type Default
event string scroll
animation_type string shift
zoom int 20
rotate_perspective int 1400
animate_duration int 1

Browser support

  • Chrome
  • Firefox
  • Opera
  • IE10/11

Dependencies

  • jQuery 1.7
  • Gsap

parallax_background's People

Contributors

lemehovskiy avatar

Watchers

Mominul Islam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.