JQuery and mouseover problem

I have the following code:

$('a.home-page-link').mouseover(function() {
        $(this).animate({
            opacity:    0.4
        }, 200, function());
    });

      

For some reason this refuses to "play ball", any ideas?

Hooray!

+2


a source to share


5 answers


Try adding {} to the second function



$('a.home-page-link').mouseover(function() {
        $(this).animate({
            opacity:    0.4
        }, 200, function() { } );
    });

      

+9


a source


$('a.home-page-link').mouseover(function() {
        $(this).animate({
            opacity:    0.4
        }, 200, function(){});
    });

      



make sure your callback function is declared correctly. then it should work. test it here: http://jsfiddle.net/5XwKG/

0


a source


Not sure if you just forgot to insert something, but the third argument .animate()

- function()

will throw an error because the body of the function is not defined: function() {}

or just leave that last argument off.

0


a source


If you don't need a callback function, leave this:

$('a.home-page-link').mouseover(function() {
    $(this).animate({
        opacity: 0.4
    }, 200);
});

      

0


a source


Have you tried this? This works for me ...

$(document).ready(function() 
{   
        $('a.home-page-link').mouseover(function() 
        {
            $(this).animate({opacity:0.4}, 200);
        });       
});

      

0


a source







All Articles