Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.05 KB

README.md

File metadata and controls

45 lines (31 loc) · 1.05 KB

code style: prettier

Image Switcher

Image Switcher Screenshot

Add image-switcher to toggle on action.

  • No localStorage, only DOM

Installation

npm i image-switcher

Usage

  1. Load image-switcher.min.js at the foot of your page:
<script src="image-switcher.js"></script>
  1. Add ID to your image switch action:
<a href="#" id="image-switcher-action">
    Switch image
</a>
  1. Add image sources and class to your image tag to switch:
<img class="image-switcher" src="images/1232.jpg" data-switch-src="images/1266.jpg">
  1. Add animation on images from animate.style:
<a href="#" class="image-switch-animation" id="image-switcher-action">
    Switch image
</a>
<img class="image-switcher" src="images/1232.jpg" data-switch-src="images/1266.jpg" data-animation="bounce">