Return to Snippet

Revision: 17991
at September 18, 2009 23:39 by mikemetcalf


Initial Code
$(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);
    });
});

Initial URL
http://www.selfcontained.us/2008/03/08/simple-jquery-image-rollover-script/

Initial Description
Add a "rollover" class and hover="img/src-hover.jpg" to the image in question.

Initial Title
Simple jQuery image hover replacement

Initial Tags
jquery

Initial Language
jQuery