1.0.5 • Published 4 years ago

vue-compare-two-images-component v1.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

Vue two images compare component

Hello. This is simple component for VueJS can help you check diffrence between two images using slider. On this page you will get to know how install and use features this component.

DEMO & EXAMPLES

Repository on Github

License: MIT

Changelog

1.0.5 - Fixed animate arrows

Features

  • Simple for using
  • Responsive (expandes from the container width, set container's height using image properly aspect ratio)
  • Flexible tuning
  • Mobile frendly

Install

Install npm package

$ npm install --save vue-compare-two-images-component

Register component globally

import CompareTwoImages from 'vue-compare-two-images-component';

// Register component as CompareTwoImages after

Vue.use(CompareTwoImages);

or import into your component directly.

import CompareTwoImages from 'vue-compare-two-images-component';

// Import CompareTwoImages component

export default {
	name: "YourComponentName",
	components: {
		CompareTwoImages: CompareTwoImages
		// Register imported component as CompareTwoImages
	}
}

After that use compare-two-images tag into template.

<template>
	<compare-two-images
		:leftImage="path/to/left.png"
		:rightImage="path/to/right.png">
	</compare-two-images>
</template>

Props

PROPERTY NAMETYPEDEFAULT VALUEDESCRIPTION
leftImageStringnullLeft image's url. This property is required
labelsEnableBooleantrueEnabling text labels for images in container
rightImageStringnullRight image's url. This property is required
leftLabelString"Left image"Left image's text label
rightLabelString"Right image"Right image's text label
leftImageOpacityNumber1Left image's opacity (from 1 to 0)
labelsPositionString"top"Text labels position in container ("top" or "bottom" values only)
labelsBackgroundColorString"rgba(37, 34, 29, 0.58)"A text label's background color (hex/rgba/rgb/none format no matter. Just use CSS correct color format)
labelsTextColorString"rgb(253, 253, 253)"A text color in label (hex/rgba/rgb/none format no matter. Just use CSS correct color format)
labelsFontSizeString"inherit"Change a text font size in label (e.g. "16px", "1em", "1rem")
labelsUppercaseBooleanfalseSetup a text decoration style in label
labelsPaddingsString"15px"Text labels's paddings (any CSS correct string value e.g. "10px 10px 10px 10px" or "1em 1.2em")
dividerPositionNumber50Initial divider horizontal position (in persents)
dividerWidthString"2px"Vertical divider's line width (any CSS correct string width value e.g. "0.25em", "4px")
dividerWidthOnHoverString"20px"Divider's width on mouse hover (any CSS correct string width value e.g. "2rem", "40px")
dividerColorString"rgb(253, 253, 253)"Divider's color (any CSS correct color format)
showAnimateArrowsBooleantrueVisibility animated arrows near divider
arrowsWidthString"20px"Size of animated arrows (any CSS correct string width value e.g. "2rem", "40px")
arrowsColorString"rgb(253, 253, 253)"Animated arrows color (any CSS correct string color value - rgb/rgba/hex)
adaptiveHeightBooleantrueEnable adaptive container's height

For additional information see documentation