setTimeOut exec the action with certain delay,
use instead Date object to set a waiting time to exec the action:
here your solution, may not work propertly but, you get the idea:
----
var onOverTime, oldOverTime = 0 // time on mouse over
var actionTime = 3 // seconds to wait before the action is executed
var isOver // true if the mouse is over, false if is out
function onMouseOver(){
isOver = true
onOverTime = date.getTime();
setTimeOut( 'execAction()', actionTime )
}
function onMouseOut(){
isOver = false
}
function execAction(){
if( !isOver ) // if mouse is not over, don't exec the function
return;
var date = new Date();
onOverTime = date.getTime();
if( oldOverTime && ( onOverTime - oldOverTime > actionTime ) ){
// exec what you want
oldOverTime = 0;
}
oldOverTime = onOverTime;
}
----
Bye
Federico
www.raintpl.com