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

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

    1. <legend id='vWRaq'><style id='vWRaq'><dir id='vWRaq'><q id='vWRaq'></q></dir></style></legend>

        延迟()或停止()超时?

        时间:2023-11-29
        <tfoot id='qFZvi'></tfoot>
          • <legend id='qFZvi'><style id='qFZvi'><dir id='qFZvi'><q id='qFZvi'></q></dir></style></legend>
            <i id='qFZvi'><tr id='qFZvi'><dt id='qFZvi'><q id='qFZvi'><span id='qFZvi'><b id='qFZvi'><form id='qFZvi'><ins id='qFZvi'></ins><ul id='qFZvi'></ul><sub id='qFZvi'></sub></form><legend id='qFZvi'></legend><bdo id='qFZvi'><pre id='qFZvi'><center id='qFZvi'></center></pre></bdo></b><th id='qFZvi'></th></span></q></dt></tr></i><div id='qFZvi'><tfoot id='qFZvi'></tfoot><dl id='qFZvi'><fieldset id='qFZvi'></fieldset></dl></div>

              <tbody id='qFZvi'></tbody>

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

                  <bdo id='qFZvi'></bdo><ul id='qFZvi'></ul>
                  本文介绍了延迟()或停止()超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  $('.file a').live('mouseenter', function() {
                      $('#download').stop(true, true).fadeIn('fast');
                  }).live('mouseleave', function() {
                      $('#download').stop(true, true).fadeOut('fast');
                  });
                  

                  我希望 mouseenter 函数有一个 stop() 和 1 秒的延迟.因此,如果我将鼠标悬停在 #download 上,则 fadeIn 应该会在 1 秒延迟后开始.如果我同时鼠标移出 fadeIn 不应该启动.找我?

                  I want the mouseenter function to have a stop() and a delay of 1 second. So, if I hover over #download the fadeIn should start after a 1 second delay. If I mouse out meanwhile the fadeIn shouldn't start. Get me?

                  我真的不知道该怎么做,有什么想法吗?

                  I don't really know how to do that, any ideas?

                  推荐答案

                  需要使用setTimeout() 在这种情况下是因为 .delay() 有效(并且您无法取消它).

                  You need to use setTimeout() in this case because of how .delay() works (and your inability to cancel it).

                  $('.file a').live('mouseenter', function() {
                    $.data(this, 'timer', setTimeout(function() {
                        $('#download').stop(true, true).fadeIn('fast');
                    }, 1000));
                  }).live('mouseleave', function() {
                    clearTimeout($.data(this, 'timer'));
                    $('#download').stop(true, true).fadeOut('fast');
                  });
                  

                  你可以在这里试试.

                  如果您使用 .delay() 它将使元素的下一个动画,无论您是否之前清除了该队列.所以你需要一个你可以取消的超时,上面通过手动调用 setTimeout() 并使用 $ 存储结果.data() 以便稍后通过 清除它clearTimeout().

                  If you use .delay() it'll dequeue the next animation for the element, regardless of if you cleared that queue earlier. So you need a timeout that you can cancel, which the above does by manually calling setTimeout() and storing the result with $.data() so you can clear it later, via clearTimeout().

                  这篇关于延迟()或停止()超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:jQuery悬停在表格上的效果 下一篇:如何在 HTML 的标题属性中添加新行/换行符

                  相关文章

                  <legend id='1ZaJZ'><style id='1ZaJZ'><dir id='1ZaJZ'><q id='1ZaJZ'></q></dir></style></legend>

                • <small id='1ZaJZ'></small><noframes id='1ZaJZ'>

                  <tfoot id='1ZaJZ'></tfoot>

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

                        <bdo id='1ZaJZ'></bdo><ul id='1ZaJZ'></ul>