jQuery change image code snippet

$("#link").click(function() {
    $("#image").fadeOut(1000, function() {
        $("#image").attr("src",$("#link").attr("href"));
    }).fadeIn(1000);
    return false;
});

Useful code snippet for image change using jQuery. In this code image will change on click. Can be change to other event trigger like mouseover, mouseout.

source

Facebook Twitter Email

Leave a Comment


7 + = 14


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>