Passing variable in jQuery through bind doesn't seem to work...

Posted by dallen on Stack Overflow See other posts from Stack Overflow or by dallen
Published on 2010-06-07T00:20:18Z Indexed on 2010/06/07 0:32 UTC
Read the original article Hit count: 438

Filed under:

Here's my code that does work:

function mouseOver()
{
    $(".beaver").fadeIn(100);

}

function mouseOut()
{
    $(".beaver").fadeOut(100);
}

$("#group_beaver").bind('mouseenter', mouseOver).bind('mouseleave', mouseOut);

But why doesn't this work?

function mouseOver(variable)
{
    $(variable).fadeIn(100);

}

function mouseOut(variable)
{
    $(variable).fadeOut(100);
}

$("#group_beaver").bind('mouseenter', mouseOver('.beaver')).bind('mouseleave', mouseOut('.beaver'));

© Stack Overflow or respective owner

Related posts about jQuery