Jquery 显示';装载';函数开始时不起作用/发生得太快

Jquery 显示';装载';函数开始时不起作用/发生得太快,jquery,internet-explorer-6,method-chaining,execution-time,Jquery,Internet Explorer 6,Method Chaining,Execution Time,我有这样的表达: $('#animationNext,#animationPrev').bind('mousedown',function(){ $('.nInfoIE').show(); $('ul.roundabout-holder li').find('.iframe').css({'visibility':'hidden'}); $('ul.roundabout-holder li').find('.iframe').addClass('escon

我有这样的表达:

$('#animationNext,#animationPrev').bind('mousedown',function(){        
    $('.nInfoIE').show();
    $('ul.roundabout-holder li').find('.iframe').css({'visibility':'hidden'});
    $('ul.roundabout-holder li').find('.iframe').addClass('esconder');

    // more code...

    watching = false;
    $('.nInfoIE').hide();
});
请注意,我删除了问题中的许多表达式

情况是,这在所有浏览器中都非常有效,但在IE6中,执行loger需要10倍的时间(我说的是7秒左右!),因此我尝试在Begging(包含一个分层图像)处显示
,并在最后隐藏它

但似乎是同时执行的,因为我永远看不到nInfoIe的内容

我怎样才能确保在看到之前看到它,然后执行其余的操作

-编辑-html代码:

<ul class="roundabout-holder" style="padding: 0px; position: relative; z-index: 100;">
    <li class="roundabout-moveable-item roundabout-in-focus" style=
    "position: absolute; left: 157.2px; top: -0.8px; width: 240px; height: 160px; opacity: 1; z-index: 400; font-size: 16px;"
    current-scale="1.0000">
      <a href="#" title="video#1"><img src="http://img.youtube.com/vi/qZ9jpnMGkdA/0.jpg"
      class="thumbImg"><img alt="video#1" class="playIcon" src=
      "img/playIcon.png"><span class="titulo titThumb">video#1</span></a>

      <div class="iframe esconder">
        <iframe width="560" height="315" frameborder="0" allowfullscreen="" src=
        "http://youtube.com/embed/qZ9jpnMGkdA"></iframe>
      </div><span class="titulo titIframe">video#1</span>
    </li>

    <li class="roundabout-moveable-item" style=
    "position: absolute; left: -58.8px; top: 23.2px; width: 168px; height: 112px; opacity: 0.7; z-index: 250; font-size: 11.2px;"
    current-scale="0.7000">
      <a href="#" title="video#2"><img src="http://img.youtube.com/vi/hurnoKLuBD8/0.jpg"
      class="thumbImg"><img alt="video#2" class="playIcon" src=
      "img/playIcon.png"><span class="titulo titThumb">video#2</span></a>

      <div class="iframe esconder">
        <iframe width="560" height="315" frameborder="0" allowfullscreen="" src=
        "http://youtube.com/embed/hurnoKLuBD8"></iframe>
      </div><span class="titulo titIframe">video#2</span>
    </li>

    <li class="roundabout-moveable-item" style=
    "position: absolute; left: 229.2px; top: 47.2px; width: 96px; height: 64px; opacity: 0.4; z-index: 100; font-size: 6.4px;"
    current-scale="0.4000">
      <a href="#" title="video#3"><img src="http://img.youtube.com/vi/Lk_WoaLUPdA/0.jpg"
      class="thumbImg"><img alt="video#3" class="playIcon" src=
      "img/playIcon.png"><span class="titulo titThumb">video#3</span></a>

      <div class="iframe esconder">
        <iframe width="560" height="315" frameborder="0" allowfullscreen="" src=
        "http://youtube.com/embed/Lk_WoaLUPdA"></iframe>
      </div><span class="titulo titIframe">video#3</span>
    </li>

    <li class="roundabout-moveable-item" style=
    "position: absolute; left: 445.2px; top: 23.2px; width: 168px; height: 112px; opacity: 0.7; z-index: 250; font-size: 11.2px;"
    current-scale="0.7000">
      <a href="#" title="video#4"><img src="http://img.youtube.com/vi/m5ykAFtQgQ0/0.jpg"
      class="thumbImg"><img alt="video#4" class="playIcon" src=
      "img/playIcon.png"><span class="titulo titThumb">video#4</span></a>

      <div class="iframe esconder">
        <iframe width="560" height="315" frameborder="0" allowfullscreen="" src=
        "http://youtube.com/embed/m5ykAFtQgQ0"></iframe>
      </div><span class="titulo titIframe">video#4</span>
    </li>
  </ul>
  • 视频#1
  • 视频#2
  • 视频#3
  • 视频#4

我只能假设“更多代码”部分适用于一个或多个ajax请求。激发ajax请求后,即使ajax请求尚未完成,也会处理下一个表达式。您应该在ajax请求的完整事件中隐藏加载图像

$.ajax({
  type: 'POST',
  url: url,
  data: data,
  success: success,
  complete: function() { watching = false;
                    $('nInfoIE').hide(); }
});

如果有多个ajax请求,它会变得有点复杂,您必须嵌套它们或使用某种ajax队列管理器。

好吧,您提供了代码,但我看不到任何具有类名“nInfoIE”的元素,这在这里有点相关

但是,我注意到您的选择器:

$('nInfoIE').show();
由于您试图通过类名获取元素,因此必须在其前面指定“.”。应该是

$('.nInfoIE').show();

没有ajax请求。只有通过jsp进行Css和HTML操作这很奇怪,在所有操作完成之前,图像不应该被隐藏。在这种情况下,我忍不住想知道是否有图像显示出来。如果忽略对hide()的调用,它是否只是停留在屏幕上?这就是问题所在。图像根本没有显示出来。问题是,我省略的代码——不是ajax,而是——在IE6中执行要花很多时间。因此,我想在执行过程中显示它,并在最后隐藏它,但我甚至看不到它:SIt可能是css的问题,或者html的结构方式,需要查看html,包括相关css的图像元素,以做出更好的判断。谢谢,我已经看到了错误,但仍然没有解决问题。div是同时播种和隐藏的——或者看起来就是这样-