
Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
universal-parallax
Advanced tools
Easy parallax plugin using pure javascript. Also works on mobile platforms. Cross browser support.
Easy parallax plugin using pure javascript. Cross browser support, including mobile platforms.
$ npm i universal-parallax -S
Include the script at the bottom of your project
<script src="node_modules/universal-parallax/dist/universal-parallax.min.js"></script>
Choose between either..
<head>
section<link href="node_modules/universal-parallax/dist/universal-parallax.min.css" rel="stylesheet">
.parallax--container {
position: absolute;
clip: rect(0, auto, auto, 0);
width: 100%;
height: 100%;
top: 0;
left: 0;
z-index: -10; /* place further back if necessary */
}
.parallax {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
/* optional - see step #3 */
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
If <section>
is your container, make the parallax element inside it, just before the closing tag
<section>
...
<div class="parallax" data-parallax-image="path/to/your_image">
</section>
background-image
in CSS, instead of using data-parallax-image=""
Fire up the JS function
new universalParallax().init();
Check the result in your project
You can change the parallax speed; the higher the number, the slower the parallax effect
new universalParallax().init({
speed: 6.0
});
Note: speed: 1.2
is the minimum value before the background image is fixed
If desired, transparency can be added to one, or all parallax elements with CSS and it won't affect the opacity of your content above
.parallax {
opacity: 0.5;
}
FAQs
Easy parallax plugin using vanilla javascript. Works on mobile devices (really). Lightweight (2kb). Cross browser compatibility
We found that universal-parallax 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.