Home

Awesome

Vue Compare Image

All Contributors

Simple Vue.js component to compare two images using slider.

img

NOTE: React Version is also available!

Demo

DEMO

Features

How to use

In the shell:

yarn add vue-compare-image

// or

npm install --save vue-compare-image

In your component file:

import VueCompareImage from 'vue-compare-image';

export default {
  name: 'app',
  components: { VueCompareImage },
};
<template>
  <VueCompareImage leftImage="image1.jpg" rightImage="image2.jpg" />;
</template>

Props

Prop (* required)typedefaultdescription
handleSizenumber (px)40diameter of slider handle (by pixel)
hoverbooleanfalseWhether to slide at hover
leftImage *stringnullleft image's url
leftImageAltstringnullleft image's alt
leftLabelstringnullLeft image text label
rightImage *stringnullright image's url
rightImageAltstringnullright image's alt
rightLabelstringnullRight image text label
sliderLineWidthnumber (px)2line width of slider (by pixel)
sliderPositionPercentagenumber (float)0.5Starting line position (from 0 to 1)

Dependencies

Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore --> <table> <tr> <td align="center"><a href="https://www.yuuniworks.com/"><img src="https://avatars0.githubusercontent.com/u/10986861?v=4" width="100px;" alt="Shota Tamura"/><br /><sub><b>Shota Tamura</b></sub></a><br /><a href="https://github.com/junkboy0315/vue-compare-image/commits?author=junkboy0315" title="Code">💻</a></td> <td align="center"><a href="https://github.com/lukasirsak"><img src="https://avatars2.githubusercontent.com/u/30669262?v=4" width="100px;" alt="Lukáš Irsák"/><br /><sub><b>Lukáš Irsák</b></sub></a><br /><a href="https://github.com/junkboy0315/vue-compare-image/commits?author=lukasirsak" title="Code">💻</a></td> <td align="center"><a href="https://morinricardo.com"><img src="https://avatars0.githubusercontent.com/u/6842945?v=4" width="100px;" alt="Ricardo Morin"/><br /><sub><b>Ricardo Morin</b></sub></a><br /><a href="https://github.com/junkboy0315/vue-compare-image/commits?author=jimmyangel" title="Code">💻</a></td> </tr> </table> <!-- ALL-CONTRIBUTORS-LIST:END -->