JQuery focus control layer display delay hiding method

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.