An open API service indexing awesome lists of open source software.

https://github.com/eugabrielsilva/image-compare

Image comparison plugin (before/after) in pure JS
https://github.com/eugabrielsilva/image-compare

before-after image-comparison javascript-plugin

Last synced: 7 months ago
JSON representation

Image comparison plugin (before/after) in pure JS

Awesome Lists containing this project

README

          

# image-compare
A very simple image comparison plugin (before/after) in pure JS.

### Demo
https://codepen.io/eugabrielsilva/pen/PodgoQB

### Usage
Include the CSS in your `` tag.

```html

```

Include the JS script before your `` closing tag.

```html

```

Add the `.image-compare` class to a container with the before/after images.

**Do not put anything else inside the container or it will break the plugin.**

```html





```

### Customization
In order to change the "Before" and "After" labels, use the `data-before-label` and `data-after-label` attributes in the container.

```html





```

If you want to modify the style, override one of the available CSS classes:

- `.image-compare` - The main plugin container.
- `.image-compare-label` - "Before" and "After" labels.
- `.image-compare-image` - Each image.
- `.image-compare-handle` - The interactive handle. The arrows are inside a pseudo `::before` element in this class.

### Credits
Developed by [Gabriel Silva](https://eugabrielsilva.tk).