Javascript Help Pleeeeeeeeeease!

andyd8

Member
I've created a toggle which works on rollover, so the user rolls over text and then information is displayed below it. The only problem is that if this is rolled over multiple times then the toggle opens and closes for how many times it was rolled over as opposed to just staying open or closing. I've posted the javascript below. Any help would be wicked, thanks.

Andy.

$(".open").hover(
function(){
$(this).next(".toggle").toggle(400);
return false;
},function(){
$(this).next(".toggle").toggle(400);
return false;
}
);
 
I could be wrong.

I'm assuming you want the 'toggle'ing item to apprear instantly when the person rolls over the text, and dissapear instantly when they exit from the text.

If that is the case, then, i think what you need to do is simple replace toggle(400) with toggle(0) as that is suggesting 400miliseconds are taken to complete the toggle action.

i.e.

$(".open").hover(
function(){
$(this).next(".toggle").toggle(0);
return false;
},function(){
$(this).next(".toggle").toggle(0);
return false;
}
);

This will make the change of state instant, which would remove the delayed effect i think you are experiencing.

Hopefully thats what your after.
 
Back
Top