1.0.0 • Published 4 years ago

@miraidesigns/parallax v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

Parallax

Add a parallax effect to <img> or <picture> elements.


HTML

<div class="mdf-parallax">
    <img src="/path/to/image.jpg" />
</div>

Sass

// Include default styles without configuration
@forward '@miraidesigns/parallax/styles';

TypeScript

import { MDFParallax } from '@miraidesigns/parallax';

new MDFParallax(document.querySelector('.mdf-parallax'));

Implementation

Classes

NameTypeDescription
mdf-parallaxParentWrapper for the parallax element

Properties

NameTypeDescription
.containerHTMLElementReturns the parallax container element
.imageHTMLElementReturns the parallax image element

Options

NameTypeDefaultDescription
delaynumber0Transition delay
directionstringupScrolling direction. Allowed values are up right down left
easingstringlinearTransition timing function
scalenumber1.2Image scaling factor to create headroom for the parallax effect. Keep above 1.2