<small id='uD2dE'></small><noframes id='uD2dE'>

  • <i id='uD2dE'><tr id='uD2dE'><dt id='uD2dE'><q id='uD2dE'><span id='uD2dE'><b id='uD2dE'><form id='uD2dE'><ins id='uD2dE'></ins><ul id='uD2dE'></ul><sub id='uD2dE'></sub></form><legend id='uD2dE'></legend><bdo id='uD2dE'><pre id='uD2dE'><center id='uD2dE'></center></pre></bdo></b><th id='uD2dE'></th></span></q></dt></tr></i><div id='uD2dE'><tfoot id='uD2dE'></tfoot><dl id='uD2dE'><fieldset id='uD2dE'></fieldset></dl></div>
      <bdo id='uD2dE'></bdo><ul id='uD2dE'></ul>

    <legend id='uD2dE'><style id='uD2dE'><dir id='uD2dE'><q id='uD2dE'></q></dir></style></legend>

    <tfoot id='uD2dE'></tfoot>

        如何在 jQuery 中制作实时自定义事件

        时间:2023-09-04

            <tbody id='LU7y5'></tbody>

            <tfoot id='LU7y5'></tfoot>
          • <small id='LU7y5'></small><noframes id='LU7y5'>

              <bdo id='LU7y5'></bdo><ul id='LU7y5'></ul>

              • <i id='LU7y5'><tr id='LU7y5'><dt id='LU7y5'><q id='LU7y5'><span id='LU7y5'><b id='LU7y5'><form id='LU7y5'><ins id='LU7y5'></ins><ul id='LU7y5'></ul><sub id='LU7y5'></sub></form><legend id='LU7y5'></legend><bdo id='LU7y5'><pre id='LU7y5'><center id='LU7y5'></center></pre></bdo></b><th id='LU7y5'></th></span></q></dt></tr></i><div id='LU7y5'><tfoot id='LU7y5'></tfoot><dl id='LU7y5'><fieldset id='LU7y5'></fieldset></dl></div>
                <legend id='LU7y5'><style id='LU7y5'><dir id='LU7y5'><q id='LU7y5'></q></dir></style></legend>
                  本文介绍了如何在 jQuery 中制作实时自定义事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  jQuery 有一个非常方便的名为 live() 的事件绑定器,它可以动态地将事件添加到 DOM 元素(即使是稍后将添加到 DOM 的元素).问题在于它仅适用于特定事件(在文档中列出).

                  jQuery has a really handy event binder called live() which will add events to DOM elements on the fly (even for the elements that will be added later to the DOM). The problem is that it's only working on specific events (listed here in documentation).

                  我真的很想进行现场直播活动,以进行焦点、模糊和更改,而现在现场直播不支持这些活动.此外,如果我可以制作实时自定义事件,这将是我的应用程序的重大改变.我现在拥有的大部分代码都致力于将旧事件(更改、焦点和自定义事件以使项目可拖动或调整大小)重新绑定到通过 ajax 添加的新 dom 元素.

                  I really want to have live events for focus,blur and change which is not supported by live right now. Besides, if I can make live custom events, it will be big game changer for my app. Most of the code that I have right now is dedicated to rebinding old events (change, focus, and custom events for making items draggable or resizable) to new dom elements that have been added through ajax.

                  有什么想法吗?我想事件委托是要走的路,但我现在它会使代码更复杂.也许是一个处理事件委托的插件......不确定.帮我找到解决办法.

                  Any idea? I guess event delegation is the way to go, but I right now it'll make the code more complicated. Maybe a plugin that handle event delegations... not sure. Help me find a solution.

                  推荐答案

                  这个功能现在在 jQuery 1.4 中可用.live() 现在支持所有 JavaScript 事件(包括自定义事件),并且引入了 focusinfocusout 事件作为 focusblur.

                  This functionality is now available in jQuery 1.4. live() now supports all JavaScript events (including custom events), and the focusin and focusout events have been introduced as bubbling versions of focus and blur.

                  来自 jQuery 1.4 文档关于 .live():

                  从 jQuery 1.4 开始,.live() 方法支持自定义事件以及所有 JavaScript 事件.两个例外:因为 focus 和 blur 实际上并不是冒泡事件,所以我们需要使用 focusin 和 focusout 来代替.

                  As of jQuery 1.4, the .live() method supports custom events as well as all JavaScript events. Two exceptions: Since focus and blur aren't actually bubbling events, we need to use focusin and focusout instead.

                  这篇关于如何在 jQuery 中制作实时自定义事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何模仿 stopImmediatePropagation() 的行为(不使用 j 下一篇:鼠标移动非常快时未正确捕获 Javascript 鼠标事件

                  相关文章

                  最新文章

                    <legend id='fEUUK'><style id='fEUUK'><dir id='fEUUK'><q id='fEUUK'></q></dir></style></legend>
                  1. <tfoot id='fEUUK'></tfoot>
                        <bdo id='fEUUK'></bdo><ul id='fEUUK'></ul>
                    1. <i id='fEUUK'><tr id='fEUUK'><dt id='fEUUK'><q id='fEUUK'><span id='fEUUK'><b id='fEUUK'><form id='fEUUK'><ins id='fEUUK'></ins><ul id='fEUUK'></ul><sub id='fEUUK'></sub></form><legend id='fEUUK'></legend><bdo id='fEUUK'><pre id='fEUUK'><center id='fEUUK'></center></pre></bdo></b><th id='fEUUK'></th></span></q></dt></tr></i><div id='fEUUK'><tfoot id='fEUUK'></tfoot><dl id='fEUUK'><fieldset id='fEUUK'></fieldset></dl></div>

                    2. <small id='fEUUK'></small><noframes id='fEUUK'>