Coder Social home page Coder Social logo

trendingtechnology / img-comparison-slider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sneas/img-comparison-slider

0.0 1.0 0.0 10.46 MB

Compare images before and after

Home Page: https://sneas.github.io/img-comparison-slider

License: MIT License

CSS 0.50% TypeScript 69.11% Shell 4.85% SCSS 17.99% JavaScript 7.55%

img-comparison-slider's Introduction

img-comparison-slider

npm package Published on webcomponents.org Built With Stencil

Slider component for comparing images (before and after).

Usage examples: https://sneas.github.io/img-comparison-slider

Example

Browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Samsung
Samsung
IE11 (limited), Edge last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions

Why yet another slider?

Because all existing solutions lack at least one of the features:

  • Mobile friendly
  • Accessible
  • Responsive
  • jQuery free
  • Compatible with modern frameworks (React, Angular, Vue)
  • Distributed through CDN or NPM
  • Zero dependencies

Installation

HTML

<script
  type="module"
  src="https://unpkg.com/img-comparison-slider@3/dist/component/component.esm.js"
></script>
<script
  nomodule=""
  src="https://unpkg.com/img-comparison-slider@3/dist/component/component.js"
></script>
<link
  rel="stylesheet"
  href="https://unpkg.com/img-comparison-slider@3/dist/collection/styles/initial.css"
/>

<img-comparison-slider>
  <img slot="before" src="before.jpg" />
  <img slot="after" src="after.jpg" />
</img-comparison-slider>

Frameworks support

Styling

The component could be styled with the help of CSS3 variables.

Example:

<style type="text/css">
  img-comparison-slider {
    --divider-width: 2px;
    --divider-color: #c0c0c0;
    --handle-opacity: 0.3;
  }
</style>

Available variables

Variable Description Default value
--divider-width Width of the vertical line dividing both images 1px
--divider-color Color of the vertical line dividing both images #d7d7d7
--handle-size Size of the handle in the middle of divider 40px
--handle-color Color of the handle in the middle of divider #d7d7d7
--handle-opacity Opacity of the handle 0.5
--handle-opacity-active On focus opacity of the handle 0

img-comparison-slider's People

Contributors

dependabot[bot] avatar semantic-release-bot avatar sneas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.