image hover animate

Posted by Ryan Max on Stack Overflow See other posts from Stack Overflow or by Ryan Max
Published on 2010-06-15T06:29:47Z Indexed on 2010/06/15 6:42 UTC
Read the original article Hit count: 326

Filed under:
|
|
|
|

Hello. I have the following jQuery script that makes an orange transparent hover effect cover the image when it's rolled over. How do I make it so this script will animate in and out (with a fade?)

$(document).ready(function() {

    $('#gallery a').bind('mouseover', function(){
        $(this).parent('li').css({position:'relative'});
        var img = $(this).children('img');
        $('<div />').text(' ').css({
            'height': img.height(),
            'width': img.width(),
            'background-color': 'orange',
            'position': 'absolute',
            'top': 0,
            'left': 0,
            'opacity': 0.5
        }).bind('mouseout', function(){
            $(this).remove();
        }).insertAfter(this);
    });

});

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html