grayscalejs

1.0.3 • Public • Published
grayscalejs

Add a GrayScale filter to images

Install

You can get it on npm.

npm install grayscalejs --save

Usage

  1. GrayScale all images in webpage
<img src="image.jpg"/>
<button  onclick="grayscale()">Click Me</button>
  1. GrayScale all images with a specific ID
<img id="myImage" src="image.jpg"/>
<button  onclick="grayscaleById("myImage")">Click Me</button>
  1. GrayScale all images with a specific Class
<img class="myImage" src="image.jpg"/>
<button  onclick="grayscaleByClass("myImage")">Click Me</button>
  1. Reset all GrayScaled images in webpage
<img src="image.jpg"/>
<button  onclick="grayscaleClear()">Clear Me</button>
  1. Reset all GrayScaled images with a specific ID
<img id="myImage" src="image.jpg"/>
<button  onclick="grayscaleClearById("myImage")">Clear Me</button>
  1. Reset all GrayScaled images with a specific Class
<img class="myImage" src="image.jpg"/>
<button onclick="grayscaleClearByClass("myImage")">Clear Me</button>
  1. Toggle all images in webpage between GrayScale and Color
<img src="image.jpg"/>
<button  onclick="grayscaleToggle()">Click Me</button>
  1. Toggle all images with a specific ID in a webpage between GrayScale and Color
<img id="myImage" src="image.jpg"/>
<button  onclick="grayscaleToggleById("myImage")">Click Me</button>
  1. Toggle all images with a specific Class Name in a webpage between GrayScale and Color
<img class="myImage" src="image.jpg"/>
<button onclick="grayscaleToggleByClass("myImage")">Click Me</button>

Demo

View Live Demo

Package Sidebar

Install

npm i grayscalejs

Weekly Downloads

1

Version

1.0.3

License

ISC

Unpacked Size

6.73 kB

Total Files

3

Last publish

Collaborators

  • iamispra