jQuery Plugin To Change The Opacity By Mouse Location

jQuery Plugin To Change The Opacity By Mouse Location
File Size: 415 KB
Views Total: 374
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A cool jQuery script to dynamically change the opacity level of an element (typically an image) based on the mouse location relative to the element's center.

How to use it:

1. Include the jQuery library and the jQuery.opacity-by-mouse.js script in your document.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="jQuery.opacity-by-mouse.js"></script>

2. Insert an image with an unique ID in your document.

<img id="demo-image" src="demo.jpg">

3. Replace the element ID with yours at the end of the jQuery.opacity-by-mouse.js.

},'#your_element_id_here'); // replace it with your element ID

This awesome jQuery plugin is developed by rmmoul. For more Advanced Usages, please check the demo page or visit the official website.