Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
parallaxbro
Advanced tools
const ParallaxBro = require('parallaxbro');
const laxbro = new ParallaxBro('#wrapper', '2000px');
const c1 = laxbro.addCollection('#collection1');
c1.addElements({
'#element1': {
top: 100, // All position values are assumed to be in px.
hide: {0: false, 500: true}, // Will hide once window.pageYOffset ≈ 500px.
center: true, // Applies 'margin: 0 auto'
speed: {
0: 1, // Speed 1 is normal scrolling rate.
500: 0, // Speed 0 will stop the element from scrolling.
1000: -1, // Negative values scroll the element in reverse.
}
zIndex: -1, // -1 is default zIndex for all elements.
update: {
0: ($el, posY) => $el.fadeOut(), // $el is jQuery wrapped element.
1000: ($el, posY) => $el.fadeIn(), // Called when window.pageYOffset ≈ 1000.
},
xFunc: (posY) => posY, // Changes the element's x position.
},
'#element2': { /* ... */ }
});
Npm:
npm i --save parallaxbro
Manually:
Find the library at: ./dist/index.js and ./dist/index.min.js
* jQuery is a required dependency
https://iamdevonbutler.github.io/parallaxbro/
See App.js to view the demo's parallaxbro config.
Parallax elements are grouped into collections. A collection is a convenient way to apply behaviors to a group of elements. Properties such as: top
, and hide
, are applied to all elements in a collection. Collections are a useful in the development of parallax designs; for instance, they offer a convenient way to either hide or position sections of your content.
In the example above, the hide
and speed
options accept both simple Boolean / Number values or a keyed object. The object keys, we call them breakpoints, change the behavior of your program when the pageYOffset position is == the breakpoint. Object values for options can be passed to both collections and elements.
c1.addElement('#wrapper', {
top: {
0: 0,
500: 100,
1000: 1000,
},
hide: {
0: false,
1500: true,
}
})
Setting the speed option to 1 will have no effect on the element. It will scroll w/ the page per normal.
Setting the speed option to a negative value will move the element in the reverse direction.
Setting the speed option to 0 will freeze the element on the page.
Leverage the update
option to preform updates of any sort at specific breakpoints:
const c1 = require('./collection');
c1.addElements('#element1', {
/**
* @param {Object} $el - element wrapped in jQuery
* @param {Number} posY
* @this - the parallax element.
*/
update: {
0: ($el, posY) => $el.fadeOut()
200: ($el, posY) => $el.fadeIn()
}
});
The xFunc option for parallax elements allows you to move elements on the x-axis in addition to the y-axis.
const c1 = require('./collection');
c1.addElements('#element1', {
/**
* @param {Number} posY
*/
xFunc: {
1200: (posY) => -posY
},
});
The callback is passed posY (pageYOffset - breakpoint), and the function should return the element's new x position.
Pass the option debug=true
to add a window.pageYOffset indicator to the page.
@param {String} selector
Selector string of the wrapper element.
@param {Number} height
Static height of the parallax page. It's useful to set it to a large number in development and change it once your design is completed.
@param {Object} [options]
const ParallaxBro = require('parallaxbro');
const laxbro = new ParallaxBro('#wrapper');
const c1 = laxbro.addCollection('#collection1', {});
@param {String} selector Selector string of the collection wrapper element.
@param {Object} [options]
Options include:
const c1 = require('./collection');
c1.addElements({
'#elementSelector': { /* options */ },
'#elementSelector2': { /* options */ },
});
@param {Object} options
Options include:
const c1 = require('./collection');
c1.addElement('#elementSelector', {
/* options */
});
@param {String} selector
Selector string of the element.
@param {Object} options
Options are the same as .addElements()
FAQs
A powerful JS parallax framework
The npm package parallaxbro receives a total of 0 weekly downloads. As such, parallaxbro popularity was classified as not popular.
We found that parallaxbro 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.