Installations
npm install @fostimus/react-img-comparison-slider
Releases
@img-comparison-slider/react-v8.0.2
Published on 06 May 2024
img-comparison-slider-v8.0.6
Published on 09 Dec 2023
img-comparison-slider-v8.0.5
Published on 26 Nov 2023
img-comparison-slider-v8.0.4
Published on 10 Nov 2023
img-comparison-slider-v8.0.3
Published on 10 Nov 2023
img-comparison-slider-v8.0.2
Published on 10 Nov 2023
Developer
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
Yes
Node Version
NPM Version
Statistics
666 Stars
414 Commits
48 Forks
8 Watching
5 Branches
10 Contributors
Updated on 28 Nov 2024
Languages
TypeScript (62.02%)
JavaScript (16.55%)
SCSS (14.2%)
HTML (3.26%)
Shell (2.98%)
CSS (0.99%)
Total Downloads
Cumulative downloads
Total Downloads
1,190
Last day
0%
3
Compared to previous day
Last week
300%
16
Compared to previous week
Last month
-5.8%
65
Compared to previous month
Last year
249.1%
925
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
img-comparison-slider
Slider Component for Comparing Images (Before and After).
Usage examples: https://img-comparison-slider.sneas.io/examples.html
Most Important Features
- Mobile friendly
- Accessible
- Responsive
- Compact - less than 12 kB minified (Or less than 4 kB if gzipped)
- Compatible with modern frameworks (React, Angular, Vue2, Vue3)
- Distributed via CDN or NPM
Installation
Browser Requirements
- Support for ECMAScript 2015 (ES6). Use Babel if needed.
- Support for Custom Elements (V1) and ShadowDOM (V1). Use Polyfills if support for older browsers is needed.
- Support for CSS Variables (Custom Properties). Polyfill it for IE11.
HTML
1<script 2 defer 3 src="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/index.js" 4></script> 5<link 6 rel="stylesheet" 7 href="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/styles.css" 8/> 9 10<img-comparison-slider> 11 <img slot="first" src="before.jpg" /> 12 <img slot="second" src="after.jpg" /> 13</img-comparison-slider>
Frameworks Support
Supported Attributes
Besides the default HTMLElement
attributes such as class
, tabindex
, title
, etc., img-comparison-slider
supports:
Attribute | Description | Default | Available |
---|---|---|---|
value | Position of the divider in percents. | 50 | 0..100 |
hover | Automatically slide on mouse over. | false | |
direction | Set slider direction. | horizontal | horizontal , vertical |
nonce | Define nonce which gets passed to inline style. | ||
keyboard | Enable/disable slider position control with the keyboard. | enabled | enabled , disabled |
handle | Enable/disable dragging by handle only. | false | true , false |
Events
The component emits slide
event when the slider position is changed by user.
Styling
Some styling techniques and ideas can be found in examples.
The component elements like the default handle or the separator line could be styled using CSS3 variables.
Example:
1<style type="text/css"> 2 img-comparison-slider { 3 --divider-width: 2px; 4 --divider-color: #c0c0c0; 5 --default-handle-opacity: 0.3; 6 } 7</style>
Available Variables
Variable | Description | Default value | Example value |
---|---|---|---|
--divider-width | Width of the vertical line separating both images | 1px | 1em |
--divider-color | Color of the vertical line separating the two images | #fff | rgba(0, 0, 0, 0.5) |
--divider-shadow | Shadow cast by the vertical line separating the two images | none | 0px 0px 5px rgba(0, 0, 0, 0.5) |
--handle-position-start | Handle position on the divider axis. In case the handle must be displaced off the center | 50% | |
--default-handle-width | Width of the default handle | 50px | |
--default-handle-color | Color of the default handle | #fff | rgba(0, 0, 0, 0.5) |
--default-handle-opacity | Opacity of the default handle | 1 | 0.3 |
--default-handle-shadow | Shadow cast by the default handle | none | 0px 0px 5px rgba(0, 0, 0, 1) |
Handle
The handle of the component can be changed by assigning the attribute slot="handle"
to any element within img-comparison-slider
.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Reason
22 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
Score
1.7
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to @fostimus/react-img-comparison-slider
img-comparison-slider
Slider component to compare images before and after
rc-slider
Slider UI component for React
@img-comparison-slider/react
React wrapper for img-comparison-slider
@react-native-community/slider
React Native component used to select a single value from a range of values.