0.1.4 • Published 3 years ago

@mangoweb/parallax v0.1.4

Weekly downloads
72
License
MIT
Repository
github
Last release
3 years ago

Parallax

The manGoweb Parallax component. Watches elements vertical position in viewport.

Demo: codesandbox.io/s/mangowebparallax-demo-hz24v

Installation

npm install @mangoweb/parallax @mangoweb/scripts-base

This is a @mangoweb/scripts-base component.

Usage

In your template:

<script>
	window.initComponents = (window.initComponents || []).push({
		name: 'Parallax',
		place: '#targetElement',
		props: {
			// Optional
			offsetPropertyName: 'offset', // distance between element y center and window y center
			heightPropertyName: 'height', // element height
			windowHeightPropertyName: 'windowHeight',
		},
	})
</script>

In your styles

#targetElement {
	transform: translateY(calc(var(--offset, 0) * 20vh)); // Translates by 0 pixels when javascript is disabled
}
0.0.11

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.0.10

4 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.3

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago