Skip to content

nebula-byte/image-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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">