Home Reference Source Repository
import BackgroundParallax from 'mini-parallax/src/BackgroundParallax.js'
public class | source

BackgroundParallax

Automatically calculate the moving distance from the height of the parent element

Constructor Summary

Public Constructor
public

constructor(target: string | NodeList | Element | Element[], options: Object)

Method Summary

Public Methods
public

Destroy instance

public

run()

Run animation

public

update()

Update cache and position

Public Constructors

public constructor(target: string | NodeList | Element | Element[], options: Object) source

Params:

NameTypeAttributeDescription
target string | NodeList | Element | Element[]

Target elements (selector or element object)

options Object
  • optional
  • default: {}
options.onResize onResize
  • optional
  • default: noop

Resize event handler

options.onScroll onScroll
  • optional
  • default: noop

Scroll event handler

options.isRound boolean
  • optional
  • default: false

Whether transform style value is rounded or not

options.autoRun boolean
  • optional
  • default: true

Whether to run automatically

Public Methods

public destroy() source

Destroy instance

public run() source

Run animation

public update() source

Update cache and position