1.0.18 • Published 1 year ago

qparallax v1.0.18

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

EN / RU

qparallax

GitHub | NpmJS | Example

qparallax

Quick Parallax

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>qparallax</title>
  <link rel="stylesheet" href="qparallax.min.css">
  <style>
    /* styles for demonstration */
    body {
      margin: 0;
      padding: 0;
      min-height: 1500px;
    }
    h2 {
      color: #fff;
    }
    button {
      padding: 5px 30px;
    }
  </style>
</head>
<body>

  <div class="qparallax">
    <div class="qparallax__upper">
      <h2>Lorem ipsum dolor amet consectetur adipisicing</h2>
      <button>More...</button>
    </div>
    <div class="qparallax__lower">
      <img src="img/gradient.jpg" alt="gradient">
    </div>
  </div>
  
  <script src="qparallax.min.js"></script>
</body>
</html>

The --indent variable from the qparallax.css file defines the top and bottom padding on the «qparallax__upper» element, as shown below:

.qparallax {
  --indent: 200px;
  ...
}

The «qparallax» block accepts a single attribute data-speed which changes the parallax speed. The higher this value, the more pronounced the effect will be.

By default, this value is 3, but you can always change it:

<div class="qparallax" data-speed="5">

By default, parallax goes to the top of the page. To set the direction to the bottom of the page, add the class "qparallax--b" to the «qparallax» block:

<div class="qparallax qparallax--b">

To create horizontal parallax, add the class "qparallax--h" to the «qparallax» block:

<div class="qparallax qparallax--h">

By default, the horizontal parallax goes to the left. To set the direction to the right, add the class "qparallax--hr" to the «qparallax» block:

<div class="qparallax qparallax--hr">
1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago