Rollover Image Effect On Hover - jQuery hovimg-z

Rollover Image Effect On Hover - jQuery hovimg-z
File Size: 68.5 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

hovimg-z is an extremely lightweight jQuery plugin that swaps the src value for a given image on hover to simulate rollover and cross-fade effects.

How it works:

  1. Shows the image on mouse enter.
  2. Hides the image on mouse leave.

Alternative libraries:

How to use it:

1. Download and insert the jquery.hovimg-z.min.js after jQuery JavaScript library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="build/jquery.hovimg-z.min.js"></script>

2. Add the CSS class 'hovimg-z' to your img tag and specify the image path to swap on hover.

<img class="hovimg-z" 
     src="before.jpg" 
     data-hovimgz="after.jpg"
>

3. Call the function and the plugin will take care of the rest.

<img class="hovimg-z" 
     src="before.jpg" 
     data-hovimgz="after.jpg"
>

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