Hello. I'd like to fire a javascript event 1000 milliseconds after an event, but I'd like to CANCEL that event if there's activity again. So a simple setTimeout wont work because it'll fire regardless. I have the following but it kinda works and kinda doesn't.
showMoveControls is triggered on mouseover and hideMoveControls is triggered on mouseout.
As you can probably tell, I'm showing additional menu options if a user hovers over a toolbar for a few moments. But if they casually are just mousing up to the toolbar or over it without pausing, then I don't want those options to show.
Any help is appreciated.
Code:var killFlag=null; function showMoveControls() { killFlag=null; setTimeout("doOpenMoveControls()", 1000) } function doOpenMoveControls() { if (!killFlag) { $('move_controls').show(); } } function hideMoveControls() { killFlag=1; $('move_controls').hide(); }


Reply With Quote

Bookmarks