Jquery hover to only have effect for certain amount of time

Posted by Andrew Cassidy on Stack Overflow See other posts from Stack Overflow or by Andrew Cassidy
Published on 2010-05-07T14:51:44Z Indexed on 2010/05/07 14:58 UTC
Read the original article Hit count: 360

Filed under:
|
|
|

Hi,

I'm using a jquery hover effect but would only like the effect to last for around a second when rolled over....ie user rolls over image, it changes for a second, then reverts back to the original image.

$(document).ready(function(){   
$(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);
    });
});

});

This is the code I'm using for the standard hover. Any help would be great, thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about hover