• <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>

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

        delay() or timeout with stop()?(延迟()或停止()超时?)
        <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().

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                    <tbody id='1ZaJZ'></tbody>
                  <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>