1.0.2 • Published 4 years ago
image-switcher v1.0.2
Image Switcher
Add image-switcher to toggle on action.
- No localStorage, only DOM
Installation
npm i image-switcher
Usage
- Load
image-switcher.min.js
at the foot of your page:
<script src="image-switcher.js"></script>
- Add ID to your image switch action:
<a href="#" id="image-switcher-action">
Switch image
</a>
- 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">
- 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">