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

NormalParallax

Parallax library

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

options.speed number
  • optional
  • default: 0.1

Moving speed (-Infinity to Infinity)

options.speedSp number
  • optional
  • default: options.speed

Moving speed in SP display (default is same as PC)

options.isSP function
  • optional
  • default: noop

Function to determine whether SP display or not

Public Methods

public destroy() source

Destroy instance

public run() source

Run animation

public update() source

Update cache and position