The example in this article describes the jQuery focus control layer display delayed hiding method. Share it with everyone for your reference. The specific implementation method is as follows:
Click me
I am the content
<script><br>
$(document).ready(function(){<br>
jQuery.focusShow({butID:'#button',divID:'#div',mouse:'over',time:'500'})<br>
})<br>
jQuery.extend({<br>
focusShow: function(config){<br>
//ps: focus control layer display, delayed hiding<br>
//focusShow({butID:'button ID',divID:'container ID',mouse:'over || click',time:'time'})<br>
var butID = $(config.butID || false),<br>
divID = $(config.divID || false),<br>
mouse = config.mouse || 'click',<br>
Time = config.time || '500',<br>
timer;<br>
function re(){$(divID).hide()}<br>
switch (mouse){<br>
case "click":<br>
butID.bind({'click':function(){divID.attr('tabindex','-1');divID.focus()}});<br>
divID.bind({<br>
"focus":function(){clearTimeout(timer);divID.show()},<br>
"blur":function(){timer = setTimeout(re,time)}<br>
})<br>
break<br>
case "over":<br>
$(butID,divID).each(function(){<br>
$(this).bind({<br>
‘mouseover’:function(){clearTimeout(timer);divID.show()},<br>
‘mouseout’:function(){timer = setTimeout(re,time)}<br>
})<br>
})<br>
break<br>
default:<br>
}<br>
}<br>
}); <br>
</script>
I hope this article will be helpful to everyone’s jQuery programming.