1. <small id='ZjOfZ'></small><noframes id='ZjOfZ'>

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

        <legend id='ZjOfZ'><style id='ZjOfZ'><dir id='ZjOfZ'><q id='ZjOfZ'></q></dir></style></legend>
        <tfoot id='ZjOfZ'></tfoot>
        • <bdo id='ZjOfZ'></bdo><ul id='ZjOfZ'></ul>

      1. 检测到双击事件时需要取消单击/鼠标事件

        时间:2023-09-05

              <tfoot id='AoFS3'></tfoot>
              • <bdo id='AoFS3'></bdo><ul id='AoFS3'></ul>

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

                  <tbody id='AoFS3'></tbody>
                <legend id='AoFS3'><style id='AoFS3'><dir id='AoFS3'><q id='AoFS3'></q></dir></style></legend>

                • <i id='AoFS3'><tr id='AoFS3'><dt id='AoFS3'><q id='AoFS3'><span id='AoFS3'><b id='AoFS3'><form id='AoFS3'><ins id='AoFS3'></ins><ul id='AoFS3'></ul><sub id='AoFS3'></sub></form><legend id='AoFS3'></legend><bdo id='AoFS3'><pre id='AoFS3'><center id='AoFS3'></center></pre></bdo></b><th id='AoFS3'></th></span></q></dt></tr></i><div id='AoFS3'><tfoot id='AoFS3'></tfoot><dl id='AoFS3'><fieldset id='AoFS3'></fieldset></dl></div>
                  本文介绍了检测到双击事件时需要取消单击/鼠标事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这是怎么做到的?

                  推荐答案

                  这是个好问题,其实我觉得也不是那么容易做到的.(对此进行一些讨论)

                  This is a good question, and I actually don't think it can be done easily. (Some discussion on this)

                  如果拥有此功能对您来说非常重要,您可以像这样破解它:

                  If it is super duper important for you to have this functionality, you could hack it like so:

                  function singleClick(e) {
                      // do something, "this" will be the DOM element
                  }
                  
                  function doubleClick(e) {
                      // do something, "this" will be the DOM element
                  }
                  
                  $(selector).click(function(e) {
                      var that = this;
                      setTimeout(function() {
                          var dblclick = parseInt($(that).data('double'), 10);
                          if (dblclick > 0) {
                              $(that).data('double', dblclick-1);
                          } else {
                              singleClick.call(that, e);
                          }
                      }, 300);
                  }).dblclick(function(e) {
                      $(this).data('double', 2);
                      doubleClick.call(this, e);
                  });
                  

                  这是一个它的工作示例.

                  正如评论中所指出的,有一个插件可以完成我在上面所做的工作,但会为你打包它,这样你就不必看到丑陋的东西:FixClick.

                  As pointed out in the comments, there is a plugin for this that does what I did above pretty much, but packages it up for you so you don't have to see the ugly: FixClick.

                  这篇关于检测到双击事件时需要取消单击/鼠标事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:替代支持 eventData 的 jQuery 的 .toggle() 方法? 下一篇:处理 js 中的 URL 锚点更改事件

                  相关文章

                  最新文章

                • <tfoot id='Zcfzr'></tfoot>
                  <legend id='Zcfzr'><style id='Zcfzr'><dir id='Zcfzr'><q id='Zcfzr'></q></dir></style></legend>
                  • <bdo id='Zcfzr'></bdo><ul id='Zcfzr'></ul>

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