
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
before-after
Advanced tools
BeforeAfter is a lightweight Javascript library to compare images in before/after view without any dependencies
before-after is a lightweight Javascript library to compare images in before/after view. The new version of the library does not use any dependencies.
NPM is the recommended installation method. Install before-after in your project with the following command:
npm install before-after --save-dev
yarn add before-after --dev
Warning before-after@3 is ESM.
Note Minimum supported
Node.jsversion is22.
The library is available as the before-after package name on npm and Github.
npm install before-after --save
yarn add before-after --dev
<div class="beforeafter">
<img src="img/before.jpg" />
<img src="img/after.jpg" />
</div>
Note The last image will be on the top
Import before-after JavaScript library as an ES6 modules.
import BeforeAfter from 'before-after';
The before-after constructor accepts the following parameters:
| Arguments | Type | Default | Description |
|---|---|---|---|
| element | HTMLElement | null | HTMLElement to target the library |
| config | Object | {} | Configuration (optional) |
Initialize the library with a CSS selector string.
new BeforeAfter(document.querySelector('.beforeafter'));
cursorType:
type cursor = boolean;
Default: true
Tells the library to enable the cursor following mouse or finger.
new BeforeAfter(document.querySelector('.beforeafter'), {
cursor: false
});
orientationType:
type orientation = 'horizontal' | 'vertical';
Default: 'horizontal'
Tells the library which orientation used.
new BeforeAfter(document.querySelector('.beforeafter'), {
orientation: 'vertical'
});
startType:
type start = number;
Default: 50
Tells the library the start position.
new BeforeAfter(document.querySelector('.beforeafter'), {
start: 30
});
destroyTells the library to destroy the instance.
beforeAfter.destroy();
before-after is licensed under the MIT License.
Created with ♥ by @yoriiis.
FAQs
BeforeAfter is a lightweight Javascript library to compare images in before/after view without any dependencies
The npm package before-after receives a total of 2 weekly downloads. As such, before-after popularity was classified as not popular.
We found that before-after demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.