Another passing variable through function jQuery/JS problem...
Posted
by dallen
on Stack Overflow
See other posts from Stack Overflow
or by dallen
Published on 2010-06-07T01:36:20Z
Indexed on
2010/06/07
1:42 UTC
Read the original article
Hit count: 228
jQuery
Here's my code:
function mouseOver(variable)
{
return function()
{
$(variable).fadeIn(100);
};
}
function mouseOut(variable)
{
return function()
{
$(variable).fadeOut(100);
};
}
function lawyer(var1, var2, var3, var4)
{
return function()
{
$(var1).bind('mouseenter', mouseOver(var2)).bind('mouseleave', mouseOut(var2)).click(
function()
{
$(var1).unbind('mouseenter').unbind('mouseleave');
$(var1).removeClass('off').addClass('on');
$(var3).bind('mouseenter', mouseOver(var4)).bind('mouseleave', mouseOut(var4));
$(var3).removeClass('on').addClass('off');
$(var4).hide();
});
}
}
lawyer("#group", ".b", "#group2", ".l");
What would be the reason for this not working?
It works in that it hides $(var4).hide();, but clicking on the object doesn't seem to do anything. It works if I take the code out of a function and just copy/paste it a few times and change the targets. I'm not seeing it... Any help would be appreciated!
© Stack Overflow or respective owner