/ Published in: jQuery

Add a "rollover" class and hover="img/src-hover.jpg" to the image in question.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(function() { $('.rollover').hover(function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }, function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }); });
URL: http://www.selfcontained.us/2008/03/08/simple-jquery-image-rollover-script/
Comments
