Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
parallaxative
Advanced tools
A vanilla JS library to help those who must implement parallax under duress. Contains several classes to help run code based on the viewport position of an HTML element.
This seems to work decently in most circumstances, but the API is very ugly; it needs massive cleanup and documentation improvements. Use at your own risk.
Special thanks to Barry T. Smith for the excellent name
/src/parallaxative.js
is an ES7 module; /dist/parallaxative.min.js
is an ES5 script you can shove into a <script>
tag. They both offer utility classes with no default side effects.
The classes are kind of documented in the module file; friendlier documentation here is on my TODO list.
/demo/demo.js
has very basic examples of how to use ScrollAnimation
and ParallaxAnimation
. Again, the API is super ugly; see the TODO below to get an idea of the improvements I want to make.
npm install
, as always. Then npm run build
to compile changes, or npm run demo
to launch the demo page.
ScrollDetector
Give its constructor an HTMLElement, and its methods will give you a float representing its relative progress across your screen:
A constructor option allows you to track horizontal instead of vertical scrolling, and all the classes below work (or can easily be made to work) with horizontal scrolling as well.
ScrollTrigger
Give its constructor a ScrollDetector
, a function, and a float, and it will run the function when the ScrollDetector
is greater than or equal to the float.
This class is most unfinished one in the library.
ScrollAnimationValueSet
This class manages the CSS values for a ScrollAnimation
; it doesn't do much beyond merging supplied options with default options. I need to think about whether this class should even exist, or just be rolled into ScrollAnimation
itself.
ScrollAnimation
Changes an element's style
attribute on scroll (throttled by requestAnimationFrame
) based on the output of a ScrollDetector
and the CSS rules you describe in one or more ScrollAnimationValueSet
s.
ParallaxAnimationValueSet
Manages the CSS values for a ParallaxAnimation
.
ParallaxAnimation
A subclass of ScrollAnimation
for the special case of a background element that needs to scroll at a precise factor of the speed at which the page is being scrolled. Handles proper sizing of the background element.
(roughly in order of importance)
ParallaxAnimation
sParallaxAnimation
s in IE by default?AnimationValueSet
classes
ParallaxAnimationValueSet.prototype.getCSSValue()
? I can't remember at the moment whether it makes sense to do thatScrollTrigger
classstartPosition
and endPosition
options in ScrollAnimation
ScrollDetector.prototype.relativeScrollPosition()
to base the 0
and 1
points at places other than immediately before/after the element scrolls onto/off the screen
ScrollAnimation
and ScrollTrigger
to allow the aboveFAQs
Utilities to run code based on the viewport position of an HTML element
We found that parallaxative demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.