You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hero-parallax

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hero-parallax

A cross-browser pure Javascript parallax plugin

2.1.1
latest
npmnpm
Version published
Maintainers
1
Created
Source

Hero Parallax

A cross-browser pure Javascript parallax plugin

Usage

  • Import it in
<body>
    <!-- Your content -->
    <script src="parallax.js"></script>
    <script>
        new Parallax();
    </script>
</body>
  • Tag sections where you want the parallax effect with the class .parallax
<div class="wrapper>
    <div
        class="parallax"
        data-parallax-background="https://images.unsplash.com/photo-1586204947495-462c218f5f05?ixlib=rb-1.2.1&auto=format&fit=crop&w=2434&q=80"
        data-parallax-height="100vh"
      >
      Some content in here
    </div>
</div>

Options

You can optionally pass in a configuration option

<body>
    <!-- Your content -->


    <script src="parallax.js"></script>
    <script>
        new Parallax({
            speedRatio: 1
        });
    </script>
</body>

Options

Options Per Parallax Section (passed into each .parallax div)

OptionRequiredDescription
data-parallax-backgroundyesThe url of the background image for the parallax section
data-parallax-heightyesThe height of the parallax section (any valid css height property)

Global Options (passed into the new Parallax())

OptionTypeDefaultDescription
debugModebooleanfalseWhether to show debug statements in the log
defaultHeightstring70vhFallback height of parallax element if one is not provided (any valid css height property)
speednumber1A speed modifier to control the speed of the parallax effect. [A number between 1 and 10]
parallaxClassNamestring.parallaxThe class selector to use to target parallax elements
wrapperClassNamestring.wrapperThe class selector to use to target parallax elements

Keywords

parallax

FAQs

Package last updated on 23 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts