1.1.6 • Published 7 years ago

slowparallax v1.1.6

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

Parallax. With momentum.

npm i --save slowparallax

Example: http://www.ofo.so/

import SlowParallax from 'slowparallax';

<SlowParallax
	class='someClass'
	content={
		<div className='myContent'>Some content</div>
	}
	distance={200}
	time={10}
	timeMax={15} // optional
	style={{ prop: 'value' }} // optional
	triggerStyle={{ otherProp: 'otherValue' }} // optional
>

yields:-

<div class="slowParallax someClass someClass999" style={{ prop: 'value' }}>
	<div class="someClassTrigger999" ref="someClassTrigger999" style={{ otherProp: 'otherValue' }} />
	<div class="myContent">Some content</div>
</div>

As the user scrolls, the someClass <div> will float lazily up & down the screen by 200px. This takes place over the course of a random amount of time between 10 and 15 seconds.

Exposed propertyTypeDefaultRequiredDescription
class or classNamestringClass name given to the outer parent <div>.
contentHTML elementHTML content which will be animated.
distancenumber200Distance in px the content will travel in each direction.
timenumber10Amount of time it will take the content to travel to its destination after each scroll event. This amount is slightly randomized to make the effect more natural.
timeMaxnumberIf provided, the time used will be a random amount between the time and timeMax.
styleobject{}Style applied to the outer parent <div>.
triggerStyleobject{}Style applied to the trigger <div>.
1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago