Forum Moderators: open

Message Too Old, No Replies

Mouseout Delay

         

almo136

9:37 pm on Aug 28, 2009 (gmt 0)

10+ Year Member



Hi,

I currently have this code which does something when I mouseout:

<span class="bar1 run" onmouseover="mouseOver1()" onmouseout="mouseOut1()"></span>

I would like to change it so that there is a delay between the mouseout and the funtion. How can this be done?

Thanks

daveVk

4:02 am on Aug 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



onmouseout="setTimeout('mouseOut1()',5000)"

5000 = 5 secs

almo136

3:44 pm on Aug 29, 2009 (gmt 0)

10+ Year Member



I have now ended up with this jquery code:

$(document).ready(function(){

$("#barcode span").hover(
function () {
$(this).addClass("barover");
},
function () {
$(this).removeClass("barover");
}
);
});

How would I add a timeout to this so that there is only a delay with the removeClass?

daveVk

12:13 am on Aug 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe, I am new to JQuery

replace

$(this).removeClass("barover");

with

$(this).animate((),slow,"linear"
,function(){$(this).removeClass("barover");}
);