Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-parallax-scroll

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-parallax-scroll

This is a simple angular plugin, that allows us to implement parallax effect for some element in page

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-7.69%
Maintainers
1
Weekly downloads
 
Created
Source

ngx-parallaxs-scroll

This is a simple angular plugin, that allows us to implement parallax effect for some element in page.

Demo

Example application: https://ngx-parallax-scroll.stackblitz.io
StackBlitz example: https://stackblitz.com/edit/ngx-parallax-scroll

Installation

Install from npm:

npm i ngx-parallax-scroll --save

Importing

Reference the directive in the main module:

import { NgxParallaxScrollModule } from 'ngx-parallax-scroll';

Then in your base module:

@NgModule({
    imports: [
        ...,
        NgxParallaxScrollModule,
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})

Using

Using as component

Use the component, providing content for parallax effect, and config.

In template:

<ngx-parallax-scroll [config]="ngParallaxConf">
  <img src="..." class="parallax-img" alt="parallax-img">
</ngx-parallax-scroll>

In component:

import { Component } from '@angular/core';
import { IParallaxScrollConfig } from 'ngx-parallax-scroll';

@Component({
  ...
})
export class AppComponent {
  ngParallaxConf: IParallaxScrollConfig = {
    parallaxSpeed: 1,
    parallaxSmoothness: 1,
    parallaxDirection: 'reverse',
    parallaxTimingFunction: 'ease-in',
    parallaxThrottleTime: 80
  };
}

Using as directive

Use the directive, providing properties:

<img src="..."
     class="parallax-img"
     alt="parallax-img"
     ngxParallaxScroll
     [parallaxSpeed]='1'
     [parallaxSmoothness]='1'
     [parallaxDirection]='"straight"'
     [parallaxTimingFunction]='"linear"'
     [parallaxThrottleTime]='0'>

or providing config:

<img src="..."
     class="parallax-img"
     alt="parallax-img"
     ngxParallaxScroll
     [config]="ngParallaxConf">

Expected properties

AttributeTypeOptinalDefaultDescription
parallaxSpeednumberno-Set scroll-speed behavior on scroll event
parallaxSmoothnessnumberno-Set smooth effect (css transition time)
parallaxDirectionstringyesstraightSet element movement direction
('straight' or 'reverse')
parallaxTimingFunctionstringyeslinearSet css timing-function.
Accept timing-function
parallaxThrottleTimenumberyes0Set throttling for scroll event

License

MIT

Keywords

FAQs

Package last updated on 13 Jul 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc