JQuery focus control layer display delay hiding method
This article mainly introduces the method of jQuery focus control layer display latency hiding. The example analyzes the jQuery operation layer technique and has some reference value. If you need it, you can refer to it.
This article describes how to hide the latency of the jQuery focus control layer. Share it with you for your reference. The specific implementation method is as follows:
The Code is as follows:
<! Doctype html>
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
</Head>
<Body>
<B id = "button"> click me </B>
<Div id = "div" style = "background: # faf; outline: none; display: none"> content </div>
<Script type = "text/javascript" src = "jquery. js"> </script>
<Script>
$ (Document). ready (function (){
JQuery. focusShow ({butID: '# button', divID:' # div ', mouse: 'over', time: '000000 '})
})
JQuery. extend ({
FocusShow: function (config ){
// Ps: Focus control layer display, latency hiding
// FocusShow ({butID: 'button id', divID: 'container id', mouse: 'Over | click', time: 'time '})
Var butID = $ (config. butID | false ),
DivID = $ (config. divID | false ),
Mouse = config. mouse | 'click ',
Time = config. time | '123 ',
Timer;
Function re () {$ (divID). hide ()}
Switch (mouse ){
Case "click ":
ButID. bind ({'click': function () {divID. attr ('tabindex', '-1'); divID. focus ()}});
DivID. bind ({
"Focus": function () {clearTimeout (timer); divID. show ()},
"Blur": function () {timer = setTimeout (re, time )}
})
Break
Case "over ":
$ (ButID, divID). each (function (){
$ (This). bind ({
'Mouseover': function () {clearTimeout (timer); divID. show ()},
'Mouseout': function () {timer = setTimeout (re, time )}
})
})
Break
Default:
}
}
});
</Script>
</Body>
</Html>
I hope this article will help you with jQuery programming.